Why the program getting error if we don't use String args[]
in main(), even in the case of not getting any arguments
from command line?
Answer / mehtaashish
First of all an in appropriate main method will not cause any
compile time error, it results in a runtime exception. The
reason for this is that the main method's signature is written
as such in Java specification. And all the interpreters and
compiler and constructed while keeping language specification
in mind. So whenever we try to run a program JVM looks for
"public static void main(String args[])" for starting
execution. And if it does not find any main method, it throws
the "NoClassDefFoundException".
Is This Answer Correct ? | 5 Yes | 0 No |
For printing a message we use System.out.println in normal programs. We use String msg="text....."; Can't we use String msg=" " in normal programs and System.out.println("........") in applets. Please answer this question?
Bubble Sort. java thereafter the user will be asked to inpout the size of the list,sort the list in ascending order and display the sorted list in a horizontal manner???
how to print a message to console without using main() function?(do not use even static blocks also.)
we compile any program bu c:/>javac prog.java and run as c:/>java prog Here what's the meaning of c in javac. We have java Interpreter but not compiler.Then why we have to use javac. Please answer this question?
what is runtime class?
how to create a (*)pyramid using java codes???
How to create and run runnable jar file of a Java Project.
4 Answers HCL, TCS, Tech Mahindra, US Consulate, Wipro,
write a c program which takes 20 numbers in an array as input from user and rearrange them in two different array defining even or odd
is public static void main() work in java?is "String arg[]" needed as argument?
How Can I Trace A Java Program . Please Give Me Step by Step Process
Why the program getting error if we don't use String args[] in main(), even in the case of not getting any arguments from command line?
Write a program to convert a decimal number to binary form?