Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

JAVA QUESTIONS : PART 32

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

finalize

delete

class

constructor

SHOW ANSWER

Which method can be defined only once in a program?

main method

finalize method

static method

private method

SHOW ANSWER

Which of this statement is incorrect?

All object of a class are allotted memory for the all the variables defined in the class

If a function is defined public it can be accessed by object of other class by inheritation

main() method must be made public

All object of a class are allotted memory for the methods defined in the class

SHOW ANSWER

What is the output of this program?
class box 
 {
       int width;
        int height;
        int length;
        int volume;
        void volume(int height, int length, int width) 
        {
             volume = width*height*length;
        } 

class Sample{
        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);     8:06 AM 6/24/2019
        } 
}
 

0

1

6

25

SHOW ANSWER

What is the output of this 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());
        } 
    }
 

 false

true

0

1

SHOW ANSWER

What is the output of this program?
class box 
    {
        int width;
        int height;
        int length;
        int volume;
        void volume() 
        {
             volume = width*height*length;
        } 
    }    
    class Sample
    { 
        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);        
        } 
    }
 

0

1

25

26

SHOW ANSWER

In the below code, which call to sum() method is appropriate?
class Output
{
 
        static int sum(int ...x)
        {
    for(int i=0;i<x.length;i++){
        System.out.print(x[i]+" ");
    }
    System.out.print("\n");
             return 1; 
        }
        public static void main(String args[]) 
        {    
             sum(10);
             sum(10,20);
             sum(10,20,30);
             sum(10,20,30,40);
        } 
}
 

only sum(10)

only sum(10,20)

only sum(10) & sum(10,20)

all of the mentioned

SHOW ANSWER

What is the output of this 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);        
        } 
    }
 

0

1

30

error

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in