+ 5
why In Java, every line of code that can actually run needs to be inside a class??
there was no need of class to run a c or cpp program.then why in java, class is used?
1 Answer
+ 9
Classes come along with object-oriented programming. C isn't an OOP language, and C++ isn't solely OOP, it's a multi-paradigm language, so it isn't bound to only the rules of OOP programming. Java is an OOP language, so all things are objects, which are instances of classes.
Hope that helps explain it for ya. Let me know if you need further elaboration.