answersLogoWhite

0

Can you have two mains in java?

Updated: 12/8/2022
User Avatar

Wiki User

13y ago

Best Answer

Yes...

We can have more than one main in JAVA...

Just make the only one main method as public and other as default access specifier....

public class Test

{

public static void main(String args[])

{

}

}

class Test1

{

public static void main(String args[])

{

}

}

class Test2

{

public static void main(String args[])

{

}

}

Just copy the above code and try....

Have fun in learning... :-) :) :-)

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you have two mains in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Who many bolts in a 350 Chevy?

Are you referring to the main caps? If you are some had two bolt mains, and some had four bolt mains.


What are the kinds of java programs?

the two types of java programs are Applet and application programs


Can a java program has two different variable?

Yes. You can have as many variables as you want in Java


What are the two types of java?

Java is a programming language that has two main types: Java SE (Standard Edition): This is the core Java language that provides all the basic features and functionalities of Java. It includes the Java Virtual Machine (JVM), which is responsible for running Java programs, and the Java Development Kit (JDK), which is used for developing Java applications. Java EE (Enterprise Edition): This is a set of Java APIs (Application Programming Interfaces) and technologies that are used for developing large-scale, distributed, and enterprise-level applications. Java EE includes a variety of APIs such as Servlets, JSPs, EJBs, JPA, JMS, and many others. These APIs provide a rich set of features for developing complex and robust enterprise applications. For more information, please visit: 1stepGrow


What were the two main sides that fought in the crusades?

The two mains sides that fought in the crusades were the Christians and Muslims.


What are the two mains types of computer program?

Operating systems and application software.


How many wheels on airbus A 318 100?

6. There are two mains, both with two wheels, and two on the nose gear.


What are two world heritage sites in Java?

Borobudur Temple and Ujung Kulon National Park are in Java.


What are the names of the two most populated islands of Indonesia?

Irian Java (Papua), andSumatra,


Name the Republic where Java and the Celebes are situated?

Java and Celebes (Sulawesi) are two of the islands of Indonesia. Sulawesi is world's 11th and Java is 13th largest Islands.


How do you display two right triangles in java?

two right triangles


Two possible hazards of using a mains powered electric drill?

electrocution abrasion