Understanding public static void main in java public static void main in java public static void main in java Let's split public static void main in java and understand it one by one. What is public static void main in java public : public is an access modifier, which specifies from where and who can access this method. public makes the method available globally. public keyword is used before the main method to specify the starting execution point of the program and will be visible to JVM. Example : What will happen if we change public to private or protected or default with no access modifier below is the code snippet for all the three and its output public class JavaCodeGeekMainExample { private static void main(String[] args) { System.out.println("Hello World"); } } public class JavaCodeGeekMainExample { protected static void main(String[] args) { System.out.println("Hello World"); } } public class JavaCodeGeekMainExample { static ...
A Blog about Java Programming Tutorials, API Features, Interview questions, Technical doubts, Java Examples, Learning Java online, Queries, Error and Exception, Issue in the project, Java coding examples, Java programming language features, Best practices, Jdk enhancements, Veracode flaw fixes, JDK Wise features, Collection API Enhancements, Database query optimization techniques, Git basics, Spring tutorials, Hibernate tutorials, Multithreading, Data structures, Database, Experience