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

Answer Posted / siva

NO only one class should be public if we write multiple
classes in a same file.we can write multiple class files in
a single file.if main() is there in one of the classes then
it should be declare as public.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the Scope of Static Variable?

982


What are the legal parameters?

732


What is the list interface in java programming?

817


When should I use stringbuffer?

795


Define a package.

787


Explain illegalmonitorstateexception and when it will be thrown?

858


What are runtime exceptions?

924


Can a class have multiple subclasses?

832


What is a method header?

789


what is method reference in java 8?

788


What is the full name of java?

827


Can you access non static variable in static context?

806


What are inbuilt functions in java?

812


How do you convert an int to a double in java?

818


Explain the difference between abstraction and encapsulation.

755