0

Java main() method

Is the main method the only static method in any program? Can only the main() method create objects?

10th Oct 2018, 1:37 AM
Maddie
Maddie  - avatar
3 Respostas
+ 4
The main method is the entry point for the JVM. You don't necessarily need to create all objects in the main method, you're free to create an object there that creates an object that creates an object etc. Also, the main method doesn't necessarily needs to be the only static method in your program, your free to use other classes that contain static methods or to invoke other static methods in the class that contains the main method.
10th Oct 2018, 6:19 AM
Tashi N
Tashi N - avatar
+ 1
using deserialisation method we can create objects in java.
10th Oct 2018, 3:46 AM
Nishanth
Nishanth - avatar
0
using new Keyword,using clone() method you can create the objects
10th Oct 2018, 6:25 AM
Nishanth
Nishanth - avatar