What is the difference between.
public class Test {
public static void main(String args[]) {
String toBeCast = "cast this string";
A a = toBeCast; // error - Type mismatch: cannot convert from String to A
Object object = toBeCast;
}
}
public class A {
}
When we say every object extends Object class, why does A a = toBeCast; not allowed, but this Object object = toBeCast; works fine.