Q1. Write the output for the following code segments. Attach a screenshot for your output. # Output [01 Mark] } Code imp
Posted: Sun May 15, 2022 1:08 pm
Q1. Write the output for the following code segments. Attach a screenshot for your output. # Output [01 Mark] } Code import java.util."; class Arraylist { public static void main(String args[]) { ArrayList obj = new ArrayList(); obj.add("A"); obj.add("B"); obj.add("C"); obj.add(2, "D"); System.out.println(obj); } class array_output { public static void main(String args[]) { int array_variable [] = new int[10]; for (int i = 0; i < 10; ++i) { array_variable = 1; System.out.print(array_variable i++; } [01 Mark] > } [01 Mark] class A { public int i; public int ); AC) { i = 1; j = 2;
class B extends A { int a; B) { super(); } } class super_use { public static void main(String args[]) { B obj - new B(); System.out.println(obj.i + "." + obj.1); } } [01 Mark] | super. i) class A { public int i; private int j; } class B extends A { void display) { super.j = super.i + 1; System.out.println(super.i + ; } class inheritance { public static void main(String args[]) { B obj = new BO); obj.i=1; obj.1-2; obj.display(); ) }
class B extends A { int a; B) { super(); } } class super_use { public static void main(String args[]) { B obj - new B(); System.out.println(obj.i + "." + obj.1); } } [01 Mark] | super. i) class A { public int i; private int j; } class B extends A { void display) { super.j = super.i + 1; System.out.println(super.i + ; } class inheritance { public static void main(String args[]) { B obj = new BO); obj.i=1; obj.1-2; obj.display(); ) }