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

Is null function in java?

785


If I only change the return type, does the method become overloaded?

728


Is string a datatype?

743


How do you use substring in java?

767


How the interruptible method gets implemented?

745


What is the benefit of singleton pattern?

746


How can you make sure that your singleton class will always return single instance in multi-threaded environment?

790


What is a numeric digit?

772


What happens when I use / and % with a negative numerator?

781


Is array synchronized in java?

805


Is empty string in java?

823


What is the impact of declaring a method as final?

763


'A class is a template for an object' explain this statement.

751


What exactly is java?

707


What is a vararg?

752