Casting I hope you mean type casting
Look into the code below
Class iTest{
public static void main(
String args[]){
float f;
f=9/2;
System.out.println(f);
}
}
Answer for this will be 4 instead of 4.5 reason is integer windup. Replace the line f=9/2 by f=(float)9/2 and you get the correct answer ie 4.5
I hope this helps you
======================
Object o = new String("Hello")
String s = o /*This line will generate and error but if you do
like String s = (String)o ...... */
I hope you got what you are looking for