Important Java Mcq 1

The main method header is written as?

a. public static void main(string[] args)

b. public static void Main(string[] args)

c. public static void main(Strings[] args)

d. public static void main(String[] args)

Answer:

d. public static void main(String[] args)

Explanation:

The main method in java is written as public static void main(String[] args).
The main method should always be declared as public only. To call the main method without
using objects we declare the main method as static. Void is the return type. String tells
about the type of array. Args means arguments.

Related MCQs

Object-oriented inheritance models the

a. “is a kind of” relationship b. “has a” relationship c. “want to be” relationship d. “contains” of relationship Answer: a. “is a kind of”

Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?