
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JVM Creates Object of Main Class in Java
As we know that Java needs main() method to be static in the public class to make it executable. The prime reason for this requirement is to make JVM enable to call the main() method without creating an object. That simply means that JVM does not create the object of the Main class which contains the main() method. To justify the same, we can make the Main class containing the main method as abstract and program still runs.
Following example showcases the same. Here we have made the main class abstract.
Example
abstract public class Tester { public static void main(String args[]) { System.out.println("Main"); } }
Output
Main