Saturday, March 24, 2018

Cast Operator of Java Programme

/* Example of Cast Operator */
package CastOperator;
public class CastOperator
{
   
    static public void main(String[] args)
    {
        int x = 11, y = 5;
        prln("x = "+x);
        prln("y = "+y);
        prln("Without Casting x/y = " +x/y);
        prln("After Casting x/(float)y = " +x/(float)y);
    }
    static void prln(Object anyObject)
    {
        System.out.println(anyObject);
    }
    static void pr(Object anyObject)
    {
        System.out.print(anyObject);
    }
   
}




Share:

0 comments:

Post a Comment

Blogger templates