Java 程序设计super关键字的一个问题
答案:3 悬赏:10 手机版
解决时间 2021-05-09 11:53
- 提问者网友:温柔港
- 2021-05-08 20:24
class Student
{
int number;
String name;
Student (int number,String name)
{
this.number=number;
this.name=name;
System.out.println("I am"+name+"my number is"+number);
}
}
class Univer_Student extends Student
{
boolean 婚否;
Univer_Student (int number,String name, boolean b)
{
super (number,name);
婚否=b;
System.out.println("婚否"+婚否);
}
public class Example
{
public void main(String args[])
{
Univer_Student zhang=new Univer_Student(9901,"和小林",false);
}
}
}
最佳答案
- 五星知识达人网友:由着我着迷
- 2021-05-08 21:33
变量名怎么试汉字呢?这个怎么编译呢?
全部回答
- 1楼网友:一秋
- 2021-05-08 22:09
改成这样。 太乱了, 以后不要用中文作为变量名
class Student { int number;
String name;
Student(int number, String name) { this.number = number; this.name = name; System.out.println("I am" + name + "my number is" + number); } }
class Univer_Student extends Student { boolean 婚否;
Univer_Student(int number, String name, boolean b) { super(number, name); 婚否 = b; System.out.println("婚否" + 婚否);
}
}
public class Example { public static void main(String[] args) { Univer_Student zhang = new Univer_Student(9901, "和小林", false); }
}
- 2楼网友:轻雾山林
- 2021-05-08 21:50
报什么錯啊?
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯