Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-22-2008, 05:30 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
'class' or 'interface' expected
I am having another problem, when i entered in this code
Code:
private static boolean number(String Number, Interface, theStub){ try{ String List = theStub.getnumber(); StringTokenizer tokens = new StringTokenizer (List); while (tokens.hasMoreTokens()) if (tokens.nextToken().equalsIgnoreCase(Number)) return true; }catch (Exception e) {System.out.println("Error : " + e); } return false; }
It was throwing me back an error class or interface expected but i can not see the problem with the code, does anyone know where i am going wrong.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-22-2008, 05:39 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Is this code in a class block?

eg

Code:
class Class1 { private static boolean number(String Number, Interface, theStub){ try{ String List = theStub.getnumber(); StringTokenizer tokens = new StringTokenizer (List); while (tokens.hasMoreTokens()) if (tokens.nextToken().equalsIgnoreCase(Number)) return true; }catch (Exception e) {System.out.println("Error : " + e); } return false; } }
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-22-2008, 05:40 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
yes this code is within a class called client
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-22-2008, 05:42 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
I take it 'Interface' & 'theStub' classes actually exsist?
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-22-2008, 06:01 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
yes i have an interface class but on the one that i am working off there is no theStub class in it.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-22-2008, 06:02 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
Even when i take out the theStub it says the same thing bout no class or interface expected
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-22-2008, 06:05 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Well thats your problem.. Its definitely theStub class. I know you have removed the word theStub but dont forget to remove the other reference to it:

Code:
String List = theStub.getnumber();
But obviousally without this none of the class will work...

You need to write theStub class for any of this to work.
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 04-22-2008, 06:07 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
Yes but how come then the other application that i have works with theStub in and no theStub class do u know?
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 04-22-2008, 06:08 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
No that does not work, I am still getting the error class or interface expected on this line private static boolean number(String Number, Interface){
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 04-22-2008, 06:13 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Remove all of this:

Code:
try{ String List = theStub.getnumber(); StringTokenizer tokens = new StringTokenizer (List); while (tokens.hasMoreTokens()) if (tokens.nextToken().equalsIgnoreCase(Number)) return true; }catch (Exception e) {System.out.println("Error : " + e); } return false;
and just run:

Code:
private static boolean number(String Number, Interface){ }
What happens?
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 04-22-2008, 06:16 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
I am getting the same error as before
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 04-22-2008, 06:21 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Does your client class have a 'main' method?

I can't really see what the problem is. Can you post all the code for each class here.
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 04-22-2008, 06:25 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
Do u want me to post all the code that i have as an attachment and then u will see it all working?

R what do u want me to post?
Bookmark Post in Technorati
Reply With Quote
  #14 (permalink)  
Old 04-22-2008, 06:27 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
I just want all the code you are using so I can look at how it is coded. I cant work out why this is not working from what you have posted. Is there a lot of code? If there isnt that much then post it here. Otherwise zip it up.
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #15 (permalink)  
Old 04-22-2008, 06:35 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
I have attached the file that i am working on, let me know if yoou need any other information
Attached Files
File Type: zip Assignment 2.zip (12.8 KB, 3 views)
Bookmark Post in Technorati
Reply With Quote
  #16 (permalink)  
Old 04-22-2008, 06:44 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Where is theStub class?

I tried getting all this code to compile but there is all sorts of errors in client.java
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #17 (permalink)  
Old 04-22-2008, 06:46 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
i said that i dont have a theStub class, with the application that i have, the first error is the class or interface expected.

I have theStub line commented out so that it is not looking for that class
Bookmark Post in Technorati
Reply With Quote
  #18 (permalink)  
Old 04-22-2008, 06:52 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Well not having theStub class is the least of your problems by the looks of it.

I know you have removed theStub from

Code:
private static boolean number(String Number, Interface){
But the rest of that code in the block relies on that class.

None of this will work:

Code:
try{ String List = theStub.getnumber(); StringTokenizer tokens = new StringTokenizer (List); while (tokens.hasMoreTokens()) if (tokens.nextToken().equalsIgnoreCase(Number)) return true; }catch (Exception e) {System.out.println("Error : " + e); } return false;
It is being called here:

Code:
String List = theStub.getnumber();
Which you already commented out but with this removed, there is no 'List' which is needed for

Code:
StringTokenizer tokens = new StringTokenizer (List);
You are going to need theStub for any of that to work.

Even with that entire code block removed there are still errors as a result in the Client class.
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by DonCash : 04-22-2008 at 06:58 PM.
Bookmark Post in Technorati
Reply With Quote
  #19 (permalink)  
Old 04-22-2008, 06:55 PM
Member
 
Join Date: Apr 2008
Posts: 31
denisdoherty is on a distinguished road
the one that i am working off is around the same as the one that i have. That does not have a theStub either so what am i suppossed to do then
Bookmark Post in Technorati
Reply With Quote
  #20 (permalink)  
Old 04-22-2008, 07:00 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
To be honist I have no idea. I removed the number method that has theStub code and there are other errors in the Client class. I commented them out and managed to compile it. This wont work as expected. I can't help you fix it any further.
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the Priority for execution of Interface class and a Abstract class Santoshbk Advanced Java 0 04-02-2008 08:04 AM
class or interface expected -compile err ravi503 Java Servlet 1 03-26-2008 12:45 PM
Generating Interface from a Class JavaForums Java Blogs 0 01-04-2008 12:20 PM
Class inside an Interface $hr!k@nt New To Java 1 12-21-2007 11:56 AM
illegal start of expression & class, interface, or enum expected silverq_82 New To Java 9 08-08-2007 08:16 PM


All times are GMT +3. The time now is 04:36 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org