11 February 2010

Interesting Fact you must know about Java Program

How many objects will be created for following source code?
public class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}


What do you think? how many 1,2,3 or zero? Obviously Answer is no..





The right answer is 5... How!

public class HelloWorld(1) extends Object(2)
{
public static void main(String(3) args[])
{
System(4).out.println("Hello World");
}
}

No comments: