Ok conceptual difficulty here - Reading and learning Java from a book
It mentions the following (over the course of explaining several different subjects) -
Java does not support multiple inheritance in the class hierarchy. So if class C is a child class of class A, then it cant also be a child class of class B (I know interfaces have a solution to offer here)
java.lang.Objectis the primordial class that all classes (system and user) 'extend'. So every class is a direct or indirect child of the classjava.lang.Objectclasses in Java are not just compiler artefacts - but at run time, are represented by the instances of the class
java.lang.Class
Doesn't #3 mean classes defined in the language themselves are of type java.lang.Class - while #2 means they are also of type java.lang.Object - contradicting #1 ? like which class are java classes children to?
And if #1 still holds, I am guessing it would mean that #3 is just saying the "runtime representation" of classes are instances of the class java.lang.Class - which is a child of java.lang.Object??, but the classes themselves are children to java.lang.Object??
Your guidance is appreciated!! Thanks in advance!
Class, andClass, like all classes, is a subclass ofObject. An instance of, say,Stringis not an instance ofClass, nor is it a subclass ofClass. It's just that theStringclass itself is an instance ofClass(and not an instance ofString).Classitself is an instance ofClass, and, furthermore, the classObjectis also an instance ofClass.)Class<Class> clazz = Class.classworks. Now I'm really confused.)