Skip to content

Commit

Permalink
Merge pull request #1174 from MacTavish-exe/patch-3
Browse files Browse the repository at this point in the history
Create SuperClass.java
  • Loading branch information
fineanmol committed Oct 24, 2021
2 parents b8f132e + 641e33d commit f4b6552
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
class Super
{
int x;
Super(int x)
{
this.x = x;
}
void display()
{
System.out.println("Super x =" +x);
}
}
Class Sub extends Super
{
int y;
sub (int x, int y)
{
super (x);
this.y=y;
}
void display()
{
System.out.println("Super x =" +x);
System.out.println("Sub y =" +y);
}
}
class OverrideTest
{
public static void main(String args[])
{
Sub sl = new Sub(100,200);
sl.display();
}
}

0 comments on commit f4b6552

Please sign in to comment.