Interview MCQs Test for Core Java - Level 3

This Test will cover complete Java with very important questions, starting off from basics to advanced level.

Q. What is the stored in the object obj in following lines of code?
box obj;
Q. What is the output of this program?
class main_class {
        public static void main(String args[])
        {
            int x = 9;
            if (x == 9) { 
                int x = 8;
                System.out.println(x);
            }
        } 
    }
Q. When we create String with new() Operator, where is it stored?
Q. Which two methods you need to implement to use an Object as key in HashMap?

Q. Can abstract class have constructor in Java. Yes or No?
Q. What is difference between "abc".equals(unknown string) and unknown.equals("abc")?
Q. Which keyword is used by method to refer to the object that invoked it?
Q. Which of the following is a method having same name as that of its class?
Q. Which method is used to perform some action when the object is to be destroyed?

Q. Which of the following stements are incorrect?
Q. What is the output of this program?
class equality {
        int x=3;
        int y=4;
        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);        } 
    }
Q. Which of these is used to access member of class before object of that class is created?
Q. What is the output of this program?
class access{
        public int x;
 	private int y;
        void cal(int a, int b){
            x =  a + 1;
            y =  b;
        }        
    }    
    class access_specifier {
        public static void main(String args[])
        {
            access obj = new access();   
            obj.cal(2, 3);
            System.out.println(obj.x + " " + obj.y);     
        }
   }
Q. Which of the following statements are incorrect?
Q. Which of these cannot be declared static?

SUBMIT TEST