Help with java installation

Started by
12 comments, last by kappa 20 years ago
Okay, I saw your code, it is definitely the (String[] argv) part that is wrong.
You need to declare the main methods with an array of strings as a parameter, so that the VM knows it is the entry point. But as you may want to call a method main, the compiler doesn't complain.

PS : ususally, the convention is to give classes a name that starts with an Upercase letter. You should have called your file (and, therfore, your class) HelloDan.java (and your class HelloDan).

What you want is :
class HelloDan {    public static void main(String[] argv){	System.out.println("Hello Dan, it's pH !!");    }} 


Good luck.
pH
[edited by - trivierph on April 14, 2004 1:18:20 PM]

[edited by - trivierph on April 14, 2004 1:21:09 PM]

[edited by - trivierph on April 14, 2004 1:21:33 PM]
Advertisement
gah, and I thougth that it was a compiler error, thanx all.

and befunge is deffinitly the hardest language
quote:
and befunge is deffinitly the hardest language

Can I had that gaelic and french are perhaps harder thatn any programming langage
Except of course Fortran.

Okay, let''s stop now, go write some classes, man !
Your class also needs to be public, and be in a file named after the class (i.e. "helloDan.java"). You can put other classes in a java file but they won''t be accessible from the outside. The general rule is that Foo.java contains

- public class Foo
- optionally, non-public classes which Foo needs for "support".

BTW, it''s conventional in Java, like in most C++ communities (except the hardcore Hungarian-notation-using ones) to begin class names with a capital letter.

This topic is closed to new replies.

Advertisement