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

How can we find the actual size of an object on the heap?

806


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

565


How do I run java on windows?

533


Difference between overriding and overloading in java?

584


What is the difference between the size and capacity of a vector?

571






What is use of set in java?

498


Why do we need hashset in java?

506


how to handle exceptions in ejb?

1881


Which is better singleton or static class?

513


Explain throw keyword in java?

618


What is nan inf?

513


Discuss about garbage collector in Java.

650


How does split work in java?

537


What is difference between path and classpath variables?

566


Is a char always 1 byte?

511