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

what is predefined function in java?

535


What is the difference between and ?

502


What is difference between null and void?

525


State some advantages of java?

708


Can java object be locked down for exclusive use by a given thread?

578






What is a marker interface?

572


What is difference overloading and overriding?

577


What does sprintf mean?

525


What is the difference between stream and buffer?

513


What is the meaning of course?

577


Explain what do you mean by functional overloading in java?

553


Define Multiprogramming and Multiprocessing in java.

573


What is the purpose of the file class in java programming?

522


What are access specifiers in java ?

588


What is an argument java?

527