Sunday, February 20, 2011
super java keyword questions and answers
Question on java keyword super and answers
(1)
class Square{
static double pi=Math.PI;
static void area(double r){
System.out.print((int)pi*r*r);
}
}
class Cube extends Square{
static void area(double r){
System.out.print(6*(int)pi*r*r);
}
}
class SuperDemo extends Cube{
public static void main(String[] args) {
Labels:
Java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment