Single Level Inheritance.
INPUT
class Single{
static int num1=10;
static int num2=5;
}
class Main extends Single{
public static void main(String[] args){
int num3=2;
int result=num1+num2+num3;
System.out.println("Result of child class is "+result);
}
}
OUTPUT
Post a Comment