Can we have multiple classes in a single file?



Can we have multiple classes in a single file?..

Answer / Rahul Bhatia

Yes, it is possible to have multiple classes within the same Java source file. Each class should be defined separately and should follow specific naming conventions (each class should have its own .java extension). However, only one public class per file is required to compile and run the program.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

wahts is mean by thread?

22 Answers   HCL, TCS,


How many bits is a boolean?

1 Answers  


Can one thread block the other thread?

1 Answers  


How do you check if a string is lexicographically in java?

1 Answers  


Can we place the any object to key attribute of HashMap<key,value>?

4 Answers   HCL,


who was the founder of java

32 Answers   CTS, HCL, ProKarma,


can java object be locked down for exclusive use by a given thread? : Java thread

1 Answers  


Why scanner is used in java?

1 Answers  


Explain how can you debug the Java code?

1 Answers   BirlaSoft,


Why hashmap is used in java?

1 Answers  


What is the difference between dom and sax parser in java?

1 Answers  


State two differences between C and Java.

1 Answers   Syntel, Visa,


Categories