Can a java program have only one class ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can a java program have only one class ??

As I saw this image :- https://www.dropbox.com/s/rsz10uvyymtt4n0/IMG_20170625_105601.jpg?dl=0 Please tell if we can have more than one class

25th Jun 2017, 5:29 AM
Mayank Sharma
Mayank Sharma - avatar
1 Answer
+ 11
Oh certainly not! The best way to plan out a Java program is to think in terms of how multiple objects will interact in order to do the work you need done! That's not too say you can't cram a whole program into a single class, but that defeats the purpose of OOP. I wouldn't recommend it.
25th Jun 2017, 5:47 AM
Jim
Jim - avatar