I think the main() doesn't have args. It is a problem. But I get the runtime error. I think it should be compiling error. Btw, main is the keyword? what is the definition of keyword. public class TestClass { public static void main(){ new TestClass().sayHello(); } //1 public static void sayHello(){ System.out.println("Static Hello World"); } //2 public void sayHello() { System.out.println("Hello World "); } //3 }
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
posted
0
No, it will be a runtime error. When the compiler comes accross your main definition, it just considers it another method. Now when you try to execute your program, the JVM cannot find a properly defined main method, then it barks! Bosun
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Mahajan Bhupendra
Ranch Hand
Joined: Dec 01, 2000
Posts: 118
posted
0
main is not a keyword u can have a varirable like int main; it works i have tried.. it's entry point of every java application..
<B>Bhupendra Mahajan</B>
Ajith Kallambella
Sheriff
Joined: Mar 17, 2000
Posts: 5782
posted
0
'X Sun' PROPER NAMES ARE NOW REQUIRED!! Please Read the JavaRanch naming policy for more details. Javaranch appreciates your cooperation to comply with the official naming policy. Ajith
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.