CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

In public static void main (), static means

A
main () is a class method and can be called without creating an object.
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
it is called many times
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
both ( 1 ) and ( 2 )
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
None of these
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C main () is a class method and can be called without creating an object.

In public static void main (), static means main () is a class method and can be called without creating an object.

Public:- it is an access specifier that means it will be accessed by publically.

Static:- it is access modifier that means when the java program is load then it will create the space in memory automatically.

Void:- it is a return type that is it does not return any value.

main():- it is a method or a function name.

A main method is static because it is available to run when your program starts and as it is the entry point of the program it runs without creating an instance of the class. In other words, static functions exist before a class is instantiated so static is applied to the main entry point

Main method has to be declared static because keyword static allows main to be called without creating an object of the class in which the main method is defined.


flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Database Structuring
ACCOUNTANCY
Watch in App
Join BYJU'S Learning Program
CrossIcon