Question
class c {
public void main( String[] args )
{
System.out.println( "Hello" + args[0] );
}
}
What is the output of this program?
class c {
public void main( String[] args )
{
System.out.println( "Hello" + args[0] );
}
}
Answer: Option D
Was this answer helpful ?
A runtime error will occur owning to the main method of the code fragment not being declared static.
Output:
$ javac c.java
Exception in thread "main" java.lang.NoSuchMethodError: main
Was this answer helpful ?
More Questions on This Topic :
Question 4.
What is Truncation is Java?
....
Submit Solution