183). Which keyword is used by the method to refer to the object that invoked it?

[A]import
[B]catch
[C]abstract
[D]this

Show Answer

184). Which of the following is a method having same name as that of its class?

[A]finalize
[B]delete
[C]class
[D]constructor

Show Answer

185). Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?

[A]delete
[B]free
[C]new
[D]none of the mentioned

Show Answer

187). What will be the output of the following Java code?
    class box 
    {
        int width;
        int height;
        int length;
        int volume;
        box() 
        {
            width = 5;
            height = 5;
            length = 6;
        }
        void volume() 
        {
             volume = width*height*length;
        } 
    }    
    class constructor_output 
    {
        public static void main(String args[])
        {
            box obj = new box();
            obj.volume();
            System.out.println(obj.volume);
        }
   }

[A]100
[B]150
[C]200
[D]250

Show Answer

188). What will be the output of the following Java code?
class San
{
     San()throws IOException
     {
 
     } 
 
}
class Foundry extends San
{
     Foundry()
     {
 
     }
     public static void main(String[]args)
     {
 
     }
}

[A]compile time error
[B]run time error
[C]compile and runs fine
[D]unreported exception java.io.IOException in default constructor

Show Answer

189). What will be the output of the following Java code?
    class box 
    {
        int width;
        int height;
        int length;
        int volume;
        void finalize() 
        {
            volume = width*height*length;
            System.out.println(volume);
        }
        protected void volume() 
       {
            volume = width*height*length;
            System.out.println(volume);
       } 
    }    
    class Output 
    { 
        public static void main(String args[])
        {
            box obj = new box();
            obj.width=5;
            obj.height=5;
            obj.length=6;
            obj.volume();
        } 
    }

[A]150
[B]200
[C]Run time error
[D]Compilation error

Show Answer

190). Which of the following statements are incorrect?
    class box 
    {
        int width;
        int height;
        int length;
        int volume;
        void finalize() 
        {
            volume = width*height*length;
            System.out.println(volume);
        }
        protected void volume() 
       {
            volume = width*height*length;
            System.out.println(volume);
       } 
    }    
    class Output 
    { 
        public static void main(String args[])
        {
            box obj = new box();
            obj.width=5;
            obj.height=5;
            obj.length=6;
            obj.volume();
        } 
    }

[A]default constructor is called at the time of object declaration
[B] constructor can be parameterized
[C]finalize() method is called when a object goes out of scope and is no longer needed
[D]finalize() method must be declared protected

Show Answer

191). What will be the output of the following Java code?
    class area 
    {
        int width;
        int length;
        int area;
        void area(int width, int length) 
        {
            this.width = width;
            this.length = length;
        }
 
    }    
    class Output 
    {
        public static void main(String args[])
        {
            area obj = new area();
            obj.area(5 , 6);
            System.out.println(obj.length + " " + obj.width);        
        } 
    }

[A] 0 0
[B]5 6
[C]6 5
[D] 5 5

Show Answer