java abstract mcq

Solutions on MaxInterview for java abstract mcq by the best coders in the world

showing results for - "java abstract mcq"
Seb
20 Jun 2018
1    class A 
2    {
3        public int i;
4        protected int j;
5    }    
6    class B extends A 
7    {
8        int j;
9        void display() 
10        {
11            super.j = 3;
12            System.out.println(i + " " + j);
13        }
14    }    
15    class Output 
16    {
17        public static void main(String args[])
18        {
19            B obj = new B();
20            obj.i=1;
21            obj.j=2;   
22            obj.display();     
23        }
24   }
Luis
03 Jul 2017
1class A 
2    {
3        public int i;
4        private int j;
5    }    
6    class B extends A 
7    {
8        void display() 
9        {
10            super.j = super.i + 1;
11            System.out.println(super.i + " " + super.j);
12        }
13    }    
14    class inheritance 
15   {
16        public static void main(String args[])
17        {
18            B obj = new B();
19            obj.i=1;
20            obj.j=2;   
21            obj.display();     
22        }
23   }
24// Output of the Code :