I think java is pure object oriented, but in real it is not. But i dont know why java is not pure object oriented language, please help me to find out the reason.
This is a homework question, right?
Primitive types, that's why. For instance try this:
int i = 42;
System.err.println(i.toString());
The usual objection is that Java is not "purely" OO because it has primitive types (int, double, etc.), which are not objects.
To make proof by contradiction: Java has int
, and int
, like all primitive types in Java, is not an Object
. There are possibly more reasons, though.
精彩评论