Why only one Class is public in one file? Explain in
details. Thanks in Advance.

Answer Posted / gopi

The class main method is start with public . This is
starting of the program, compiler have to know where to
start the program to compile. so only one public is there to
avoid confusion. We also use the public method to interact
with the out side of the programs. Without using of the
public class it can't possible to interact.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we write class inside a class in java?

548


What is Java Reflection API? Why it’s so important to have?

599


What are the different types of inner classes?

531


Why char array is favored over string for the storage of passwords?

555


Is null an object java?

538






What does file separator do in java?

534


What lambda means?

541


What are the 5 types of research methods?

585


What is java and its types?

549


Java.util.regex consists of which classes?

541


What is var keyword ?

735


what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread

495


What is charat ()?

525


what do you mean by marker interface in java?

541


This abstract class is correct ? abstract class A { public abstract void Disp(); public abstract void B() { } public absract virtual C() { } }

557