Mancora
09-20-2003, 09:55 PM
ok, after i cut out all of the inside stuff heres where im getting the error
class Switchtest {
switch(5) {
default:
System.out.println("p");
}
}
That should be valid right? Well heres the error im getting
d:\prog\java>javac switch.java
switch.java:4: illegal start of type
switch(5) {
^
switch.java:7: <identifier> expected
}
^
2 errors
d:\prog\java>
The second error is due to the first one, since its not recongizing switch, though WHY? When i add in the main method it compiles just fine.
class Switchtest {
public static void main(String[] args) {
switch(5) {
default:
System.out.println("p");
}
}
}
I should be using the 1.4.2 Java SDK
class Switchtest {
switch(5) {
default:
System.out.println("p");
}
}
That should be valid right? Well heres the error im getting
d:\prog\java>javac switch.java
switch.java:4: illegal start of type
switch(5) {
^
switch.java:7: <identifier> expected
}
^
2 errors
d:\prog\java>
The second error is due to the first one, since its not recongizing switch, though WHY? When i add in the main method it compiles just fine.
class Switchtest {
public static void main(String[] args) {
switch(5) {
default:
System.out.println("p");
}
}
}
I should be using the 1.4.2 Java SDK