class Client {
public static void main(
String args[]) {
String stringRef = new String("java");
System.out.println("2):" + stringRef.getClass());
System.out.println("(3):" + stringRef.length());
Object obref = stringRef;
System.out.println("(6):" + obref.equals("Java"));
System.out.println("(7):" + obref.getClass());
stringRef = (String)obref;
System.out.println("(9):" + stringRef.equals("C++"));
System.out.println("(5):" + obref.length());
}
}
this code doesn't compile. I understand that length() method is not avialable
in the Object class so it gives the error. But i have type casted obref into stringRef so why does it gives the error.