Please take time and answer it correctly and properly.
Posted: Tue Jul 05, 2022 10:27 am
Please take time and answer it correctly and properly.
3. a) What will be the output of the Java program? class First { int i = 10; public First (int j) { } } System.out.println(i); this.i j* 10; } class Second extends First { public Second(int j) { super (j); System.out.println(i); this.i j* 20; public class MainClass { public static void main(String[] args) { Second n = new Second (20); System.out.println(n.i); } } b) Write a java program to create an abstract class named Shape that contains two integers and an empty method named printArea(). Provide three classes named Rectangle, Triangle and Circle such that each one of the classes extends the class Shape. Each one of the classes contain only the method printArea() that prints the area of the given shape. c) What is difference between abstract class and interface in Java?
3. a) What will be the output of the Java program? class First { int i = 10; public First (int j) { } } System.out.println(i); this.i j* 10; } class Second extends First { public Second(int j) { super (j); System.out.println(i); this.i j* 20; public class MainClass { public static void main(String[] args) { Second n = new Second (20); System.out.println(n.i); } } b) Write a java program to create an abstract class named Shape that contains two integers and an empty method named printArea(). Provide three classes named Rectangle, Triangle and Circle such that each one of the classes extends the class Shape. Each one of the classes contain only the method printArea() that prints the area of the given shape. c) What is difference between abstract class and interface in Java?