Select Page

Welcome to your Java Test

Name
E mail
1.What is Inheritance? Give example also.(2 marks)
2.Write sample code to show method overloading and method overriding. Explain the difference between the two.(4 marks)
3.What are the different types of access specifiers? Explain the difference between them.(4 marks)
4.Write the output of below program (2 marks):

class Test  



    public static void main (String args[])   { 


        System.out.println(10 + 20 + "Indeed");  


        System.out.println("Prushal" + 10 + 20); 


    } 


5.What is constructor? (2 marks)
6.Write the output of below program (2 marks):

class Test  



    int _a, _b; 


    Test(int a, int b)  


    { 


    _a = a;  


    _b = b;  


    } 


    public static void main (String args[])    { 


        Test test = new Test();  


        System.out.println(test._a+" "+test._b); 


    } 


7.What is the difference between static (class) method and instance method? Give example. (4 marks)
8.What are the differences between this and super keyword? (2 marks)
9.Write the output of below program (2 marks):

class Person  



    public Person()   { 


        System.out.println("Person class constructor called"); 


    } 



public class Employee extends Person  



    public Employee()   { 


        System.out.println("Employee class constructor called"); 


    } 


    public static void main (String args[])  { 


        Employee e = new Employee(); 


    } 


10.What is difference between list and vector? (4 marks)
11.Write a Java program to find the minimum value in a given array. (4 marks)