Welcome to your Java Level 2

1. 
Which of the following inheritance is not supported in Java?

2. 
What is the process of defining multiple methods having same name but different parameters in a class?

3. 
Which of the following keywords is used to raise exception manually in Java?

4. 
What will be the output of the following Java code?

class edSlash
    {
        public static void main(String args[])
        {
            try
            {
                int m, n;
                n = 0;
                m = 5 / n;
                System.out.print("Java");
            }
            catch(ArithmeticException e)
            {
                System.out.print("edSlash");           
            }
        }
    }

5. 
What will be the output of the following Java code?

import java.util.*;
    class edSlash
    {
        public static void main(String args[])
        {
            ArrayList obj = new ArrayList();
            obj.add("Rahul");
            obj.add("Rajat");
            obj.add("Rakesh");
            obj.add(0, "Rajiv");
            System.out.println(obj);
        }
    }

6. 
Which of the following class generates a dynamic array in Java?

7. 
What is the number of primitive data types in java?

8. 
Which of the following features is not supported by Java?

9. 
When does Java raises exceptions in the code?

10. 
Which of the following method is used to obtain a single character from a String?

11. 
What will be the output of following Java code?

class edSlash
    {
        public static void main(String args[])
        {
            int a;
            a = 10;
            {
                 int b = 20;
                 System.out.print(a + b);
             }
             System.out.println(a + b);
         }
    }

12. 
What is the worst case time complexity of accessing an element in ArrayList?

13. 
Which of the following method can have the same name as that of it’s class?

14. 
What is the process called when child object gets destroyed due to the parent object?

15. 
Which of the following is not a bitwise operator in Java?

16. 
Which of the following Java object stores in the form of key value pairs?

17. 
Which of the following methods is used to add an element in the beginning of a LinkedList?

18. 
Which of the following are the access modifiers in Java?

19. 
What will be the output of the following Java code?

class Car
    {
        void display()
        {
            System.out.println(“This is a Car”);
        }
    }   

class Jeep extends Car
    {
        void display()
        {
            System.out.println(“This is a Jeep”);
        }
    }  

class edSlash
    {
        public static void main(String args[])
        {
            Jeep obj=new Jeep();
            obj.display();    
        }
    }

20. 
Which of the following keyword is used to inherit a class?