We need a main method for executing a program.
But YES we can write a program without using main() method.
TRICK 1 of 2 :: while writing applets in java we don't use main... we use init() method instead.
TRICK 2 of 2 :: using 'static' we can write a program whic will execute successfully and output the desired message on screen. Here it is :: class Mohit{ static { System.out.println("This java program has run without the main method"); System.exit(0); } } -->save the program as Mohit.java to compile::javac Mohit.java (in command prompt) to run ::java Mohit(command prompt) output will be ::This java program has run without the main method
Whoa!!!!! we are done.
;)
A Java program needs an entry point - a class with a main() method. This tells the JVM where to start executing code. Once you have such a program, it can invoke other classes, which don't need a main() method.
There can only be one entry point per program. The main method serves as that entry point and therefore cannot be overloaded.
you can not write a java program without using even single class..............
How to write a program for secant method by mathematica
sdfdg
This is not a question.
When you start your xxxx.class it will execute its 'public static void main (String args[])' method. Any other main methods won't be executed, only if your program explicitly calls them.
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
How to write a program for secant method by mathematica
i need this answer
sdfdg
not possible dude
This is not a question.
Technically yes, practically no.
To swap two variables without using a third variable, use exclusive or manipulation... a ^= b; b ^= a; a ^= b;
a=a^b; b=a^b; a=a^b;
When you start your xxxx.class it will execute its 'public static void main (String args[])' method. Any other main methods won't be executed, only if your program explicitly calls them.
Certainly, you can write a program without main, but you cannot build an executable from it, if that is okay with you.
write a sample program using asp.net explaining all the syntax and semantics of the program
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?