wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes java error class, interface, or enum expected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java error class, interface, or enum expected " Watch "java error class, interface, or enum expected " New topic
Author

java error class, interface, or enum expected

deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi,

i am having an code like this for split program in java



[Added code tags - see UseCodeTags for details]


and i am getting an error like this

StringSplit.java:21: class, interface, or enum expected
public static void main(String args[]) throws Exception{
^
StringSplit.java:23: class, interface, or enum expected
ss.doit();
^
StringSplit.java:24: class, interface, or enum expected
}
^
3 errors

can any one help me how to get out the result?



Harsha Ka
Ranch Hand

Joined: Mar 14, 2010
Posts: 45

Wrong forum..

But nevertheless you have put your main method outside the class


SCJP 1.6,Preparing (Tryin to prepare) for scwcd
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4490
    
    8

(I've moved the forum).

It's more obvious once the code is formatted correctly (I've just added code tags and fixed the indentation - see UseCodeTags if you want to know more about them). Then you can clearly see the main method is outside the class, as Harsha says. In Java all code must be inside a class.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
ya changed the format. thank's yaar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java error class, interface, or enum expected