Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes can't run Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can Watch "can New topic
Author

can't run

Andrew Lit
Ranch Hand

Joined: Jul 01, 2002
Posts: 135
why can't i run such class:
public class class(){
void method(){
}
........
public static void main (String args[]){
..........
}
}
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

What error are you getting?
This should work:

/Rene
[ July 04, 2002: Message edited by: Rene Larsen ]

Regards, Rene Larsen
Dropbox Invite
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You can compile it because class is a reserved word in Java and in Java we do not put () after the name.
/Rene
Andrew Lit
Ranch Hand

Joined: Jul 01, 2002
Posts: 135
it works indeed. the problem was because i didn't use static keyword in my code (for some reasons )
but thanx anyway.
 
wood burning stoves
 
subject: can't run