173). What is the process of defining more than one method in a class differentiated by method signature?

[A]Function overriding
[B] Function overloading
[C] Function doubling
[D]None of the mentioned

Show Answer

174). Which of the following is a method having same name as that of it’s class?

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

Show Answer

175). Which method can be defined only once in a program?

[A]main method
[B] finalize method
[C]static method
[D]private method

Show Answer

176). Which of this statement is incorrect?

[A]All object of a class are allotted memory for the all the variables defined in the class
[B]If a function is defined public it can be accessed by object of other class by inheritation
[C] main() method must be made public
[D]All object of a class are allotted memory for the methods defined in the class

Show Answer

177). What will be the output of the following Java program?
    class box 
    {
        int width;
        int height;
        int length;
        int volume;
        void volume(int height, int length, int width) 
        {
             volume = width*height*length;
        } 
    }    
    class Prameterized_method
    {
        public static void main(String args[])
        {
            box obj = new box();
            obj.height = 1;
            obj.length = 5;
            obj.width = 5;
            obj.volume(3,2,1);
            System.out.println(obj.volume);        
        } 
     }

[A]0
[B]1
[C]6
[D]25

Show Answer

178). What will be the output of the following Java program?
    class equality 
    {
        int x;
        int y;
        boolean isequal()
        {
            return(x == y);  
        } 
    }    
    class Output 
    {
        public static void main(String args[])
        {
            equality obj = new equality();
            obj.x = 5;
            obj.y = 5;
            System.out.println(obj.isequal());
        } 
    }

[A]false
[B]true
[C]0
[D]1

Show Answer

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

[A]0
[B]1
[C]25
[D]26

Show Answer

180). In the following Java code, which call to sum() method is appropriate?
class Output 
{
 
        public static int sum(int ...x)
        {
             return; 
        }
        static void main(String args[]) 
        {    
             sum(10);
             sum(10,20);
             sum(10,20,30);
             sum(10,20,30,40);
        } 
}

[A]only sum(10)
[B]only sum(10,20)
[C]only sum(10) & sum(10,20)
[D]all of the mentioned

Show Answer

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

[A]0
[B]1
[C]30
[D]error

Show Answer