Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
394 B
2
Indexable
Never
class Superclass
{
void add(int a,int b)
{
int c=a+b;
System.out.println("Addition is "+c);
}
}
class subclass extends Superclass
{
void sub(int a,int b)
{
int c=a-b;
System.out.println("substraction is"+c);
}
}
class Demo
{
public static void main(String args[])
{
Superclass s1=new Superclass();
s1.add(5,6);
subclass s2=new subclass();
s2.sub(5,10);
s2.add(15,27);
}
Leave a Comment