| 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: 42
|
|
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: 3793
|
|
(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
|
 |
 |
|
|
subject: java error class, interface, or enum expected
|
|
|