+ 2

CPP and java both are OOP but for running a simple program why we need to define a class in java but not in cpp?

14th May 2018, 2:36 PM
Rohit
Rohit - avatar
5 Answers
+ 2
C++ is a procedural language like C but it also has the possibility of object-oriented programming. So it needs the main function for program running. Java is pure OOP and it needs class.
14th May 2018, 2:49 PM
MichaƂ Biernacki
MichaƂ Biernacki - avatar
+ 5
Java creators decided that everything must be within a class. C++ started with the C language and added OOP to it as such it maintained backward compatibility with C so those programs could easily be ported.
14th May 2018, 2:47 PM
John Wells
John Wells - avatar
+ 2
MichaƂ Biernacki & Yadab Sutradhar Java is not a complete OOP language. Primitive types like int, boolean, etc still exist in Java. https://stackoverflow.com/questions/974583/is-java-100-object-oriented
15th May 2018, 3:33 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
0
java is fully oop but c++ is not fully.
14th May 2018, 5:33 PM
Yadab Sutradhar
Yadab Sutradhar - avatar
0
java is able to wrap that primitive data types and use as a object by some wrapping classes. it act oop without any doubt. you should follow books of some experts.
15th May 2018, 5:46 AM
Yadab Sutradhar
Yadab Sutradhar - avatar