Post

JavaJava

K
Kusum Agarwal

Posted on 26th April 2024|133 views

0
votes

What Is Public Static Void Main In Java?

Recently, I started learning Java programming language. I got a learning guide from the library. While I’m working on the example programs, I found that in all example the ‘public static void main’ comes before any method is being used or created. What does it mean?

 

Answers
P
Dikshit Jain

Posted on 26th April 2024

Hey Dikshit,


The function public static void main is a point from where the program begins its execution or entry the point of Java program is the main() method. Hence, it is an important core method in Java program and it can not return values and accepts parameters for complex command-line processing.

Syntax:

class Mindmajix {
	public static void main(String[] args)
	{
		System.out.printIn(“I am Keerthana”);
	}
}

Here, public means the method is visible and can be called from other objects, static means the method is associated with the class, not a specific object of the class, the void is the keyword and used to specify that a method doesn’t return anything, and main is the name of the Java main() method. 

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos