In java object typecasting one object reference can be type cast into another object reference. The cast can be to its own class type or to one of its subclass or superclass types or interfaces. There are compile-time rules and runtime rules for casting in java.
/* Simple Type casting program */
class cast
{
public static void main(String args[])
{
double a=5.35, b=55.6;int rem;
rem = (int)a% (int)b;
System.out.println("Remainder : "+rem);
}
}
/* Output Remainder : 5 */
Sunday, September 28, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment