//Method Overriding
class One
{
void cal(double x)
{
System.out.println("Square :----"+(x*x));
}
}
class Two extends One
{
void cal(double x)
{
System.out.println("Sqare root:--------"+Math.sqrt(x));
}
};
class Overriding
{
public static void main(String arg[])
{
Two t=new Two();
t.cal(16.555555);
}
};
No comments:
Post a Comment