Wednesday, December 22, 2010

Java-Reference variable: super




class TestSuperFunc {
public static void main(String[] args) {
SubClass sub = new SubClass(10, 20, 30);
}
}

class SuperClass {
private int x = 0;
private int y = 0;

SuperClass() {
}
SuperClass(int value) {
x = value;
y = value;
}
SuperClass(int x, int y) {
this.x = x;
this.y = y;
}
}
class SubClass extends SuperClass {
private int z = 0;

SubClass() {
}
SubClass(int value) {
super(value);
z = value;
}
SubClass(int x, int y, int z) {
super(x, y);
this.z = z;
}
}


0 comments:

Post a Comment

Contact Form

Name

Email *

Message *

The Insane Techie - Android App

Launched an android app for the blog on 07th June 2016. Get it from google play store... Tips for using the app Use in landscape mo...