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

Is sizeof a keyword in java programming?

841


Explain the JDB in depth & command line.

806


What are peerless components?

857


What is e in java?

748


Is java same as core java?

837


What is ternary operator?

775


Does set allows null in java?

725


Can a static method be overridden in java?

774


What is the difference between length and size in java?

733


What does a za z0 9 mean?

767


What are access specifiers in java ?

817


Why does java have two ways to create child threads?

703


how we can make a read-only class in java?

780


What is substring in java?

846


What is super in java?

781