Sunday 20 February 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) {

        

No comments:

Post a Comment