can two class in a code be public??if yes then how??

Answer Posted / sreejesh1987

One java source file must have only one top-level(top level means not an inner class) public class with the same name as the name of the source file .


You can have inner classes to a class which are public. Hence in this way it is possible to have more than one public class in a single file.

Is This Answer Correct ?    11 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain differences between checked and unchecked exceptions in java?

842


What is passing value java?

704


Can a class be private?

701


How do you end a program?

762


Is 9 a prime number?

651


Explain java coding standards for methods?

813


Why java is made?

757


What is static synchronization?

768


Can we overload run() method in java?

855


What do you mean by exception handling in Java?

985


What are java packages?

805


How do you reverse a list?

769


What do you mean by object?

725


how are methods defined?

791


Is java map thread safe?

703