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 3

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

What is the return type of Constructors?

int

float
void
None of the mentioned

SHOW ANSWER

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

import
catch
abstract
this
SHOW ANSWER

What is process of defining two or more methods within same class that have 
same name but different parameters declaration?

method overloading
method overriding
method hiding
None of the mentioned

SHOW ANSWER

Which of these can be overloaded?

Methods
Constructors
All of the mentioned
None of the mentioned

SHOW ANSWER

What is the process of defining a method in terms of itself,
that is a method that calls itself?

Polymorphism
Abstraction
Encapsulation
Recursion
SHOW ANSWER

What is the output of the following code?
    

class San
{

         public void m1 (int i,float f)
 {
 
             System.out.println(" int float method");
 
        }
 

         public void m1(float f,int i);
  {
 
             System.out.println("float int method");
  
        }
 
  
        public static void main(String[]args)
  {
 
           San s=new San();
    
           s.m1(20,20);
 
         }

    }

int float method
float int method
compile time error
run time error
SHOW ANSWER

What is the output of this program?


        class overload {

                    int x;
    
         int y;
        
        void add(int a) {

                    x =  a + 1;
  
                }

                void add(int a, int b){
        
            x =  a + 2;
        
        }
            
    }
        
    class Overload_methods {
        
        public static void main(String args[])
{
 
                   overload obj = new overload();
           
            int a = 0;
        
            obj.add(6);

                    System.out.println(obj.x);
            
        }
 
          }

5

6

7

8

SHOW ANSWER

What is the output of this program?
        

class overload {
        
        int x;
        
     int y;
        
        void add(int a){
        
            x =  a + 1;
        
        }
        
        void add(int a , int b){
        
            x =  a + 2;

                }
            
    }
        
    class Overload_methods {
        
        public static void main(String args[])
{

                    overload obj = new overload();
           
            int a = 0;

                       obj.add(6, 7);
           
            System.out.println(obj.x);
            
        }

            }

6

7

8

9

SHOW ANSWER

What is the output of this program?
         

class test {
    
        int a;

            int b;

            void meth(int i , int j) {
    
            i *= 2;

                j /= 2;
    
        }
          
    }
        
    class Output {
        
        public static void main(String args[]){

                    test obj = new test();
        
        int a = 10;
        
            int b = 20;
                
            obj.meth(a , b);
        
            System.out.println(a + " " + b);
            
        }
        
    }
 

10 20
20 10
20 40
40 20

SHOW ANSWER

Which of these access specifiers must be used for main() method?

private
public
protected
None of the mentioned

SHOW ANSWER

Which of these is used to access member of class before object of that class is created?

public
private
static
protected
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