public class Foo {
}
// ...
Foo f = new Foo();
Object o = f;Which statement is true?
- A
Object is a primitive type
- B
Foo cannot be assigned to an Object reference
- Ccheck_circle
Every class implicitly extends Object, so Foo is-a Object
- D
Foo cannot inherit from Object because Foo has no superclass
Explanation
All Java classes (other than Object itself) implicitly extend Object, so a Foo reference is assignable to an Object reference.