class Plate {
Plate(int i) {
System.out.println("Plate constructor");
}
}class DinnerPlate extends Plate {
DinnerPlate(int i) {
super(i);
System.out.println(
"DinnerPlate constructor");
}
}class Utensil {
Utensil(int i) {
System.out.println("Utensil constructor");
}
}class Spoon extends Utensil {
Spoon(int i) {
super(i);
System.out.println("Spoon constructor");
}
}class Fork extends Utensil {
Fork(int i) {
super(i);
System.out.println("Fork constructor");
}
}class Knife extends Utensil {
Knife(int i) {
super(i);
System.out.println("Knife constructor");
}
}// A cultural way of doing something:
class Custom {
Custom(int i) {
System.out.println("Custom constructor");
}
}public class PlaceSetting extends Custom {
Spoon sp;
Fork frk;
Knife kn;
DinnerPlate pl;
PlaceSetting(int i) {
super(i + 1);
sp = new Spoon(i + 2);
frk = new Fork(i + 3);
kn = new Knife(i + 4);
pl = new DinnerPlate(i + 5);
System.out.println(
"PlaceSetting constructor");
}
public static void main(String[] args) {
PlaceSetting x = new PlaceSetting(9);
}
}这是 简单的子类继承父类 但是super的函数里的参数我不知道什么意思 还有在PlaceSetting函数里面super(i + 1);
sp = new Spoon(i + 2);
frk = new Fork(i + 3);
kn = new Knife(i + 4);
pl = new DinnerPlate(i + 5);什么意思啊?
Plate(int i) {
System.out.println("Plate constructor");
}
}class DinnerPlate extends Plate {
DinnerPlate(int i) {
super(i);
System.out.println(
"DinnerPlate constructor");
}
}class Utensil {
Utensil(int i) {
System.out.println("Utensil constructor");
}
}class Spoon extends Utensil {
Spoon(int i) {
super(i);
System.out.println("Spoon constructor");
}
}class Fork extends Utensil {
Fork(int i) {
super(i);
System.out.println("Fork constructor");
}
}class Knife extends Utensil {
Knife(int i) {
super(i);
System.out.println("Knife constructor");
}
}// A cultural way of doing something:
class Custom {
Custom(int i) {
System.out.println("Custom constructor");
}
}public class PlaceSetting extends Custom {
Spoon sp;
Fork frk;
Knife kn;
DinnerPlate pl;
PlaceSetting(int i) {
super(i + 1);
sp = new Spoon(i + 2);
frk = new Fork(i + 3);
kn = new Knife(i + 4);
pl = new DinnerPlate(i + 5);
System.out.println(
"PlaceSetting constructor");
}
public static void main(String[] args) {
PlaceSetting x = new PlaceSetting(9);
}
}这是 简单的子类继承父类 但是super的函数里的参数我不知道什么意思 还有在PlaceSetting函数里面super(i + 1);
sp = new Spoon(i + 2);
frk = new Fork(i + 3);
kn = new Knife(i + 4);
pl = new DinnerPlate(i + 5);什么意思啊?
解决方案 »
- 把一元钞票换成一分、二分、五分硬币(每种至少一枚),有多少种换法?---使用递归
- 我做了一个单机版小游戏,就是不知道怎么改成网络版的,请教一个问题
- SAX解析大数据量的xml文件获取字符内容的问题
- thinking in java中关于set的问题,请教
- jtable嵌套JTable
- java学习
- 哪位兄弟能提供空间,我想上传两个文件(不到2M),非常感激!顺便告诉大家几个google的IP,不需要使用代理就可以用google了!
- 我想请教一下jtextpane 插入图片文字 混合时,,如何计算 图片的位置。。
- JAVA做项目
- JAVA太难懂了
- 如果修改方法参数所指向的值
- 求助java JTable!!!
Game(int i) {
System.out.println("Game constructor");
}
}class BoardGame extends Game {
BoardGame(int i) {
super(i);
System.out.println("BoardGame constructor");
}
}public class Chess extends BoardGame {
Chess() {
super(11);
System.out.println("Chess constructor");
}
public static void main(String[] args) {
Chess x = new Chess();
}
} 这个我也懂你看这个上面super(11);难道就是为了向父类入参感觉这11一点也没有只是说明他是int型