Google Search

Monday, October 10, 2011

Java Program for function overridding


import java.io.*;
class one
{
void calculate(double x)
{
System.out.print("square="+(x*x));
}
}
class two extends one
{
void calculate(double x)
{
System.out.print("square root="+Math.sqrt(x));
}
}
class overriding
{
public static void main(String args[])
{
two t=new two();
t.calculate(25);
}
}

0 comments:

Post a Comment