Hello everyone ! This is my first blog. The following is a hello world program in Java.
class hello {
public static void main(String args[]) {
System.out.println("hello world !");
}
}
Attention:
1) While you are writing this program, you should pass "String args[]" as the argument to the main method.
If you do not pass an array of String as an argument, it will cause this exception:
Exception in thread "main" java.lang.NoSuchMethodError: main.
2) When you write a method , you'd better write the return type directly in front of the method name.
public static void main() { ... } // OK
public void static main() { ... } // error !