房屋结构风水:谁能帮我译一下这个,谢谢!

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/03 02:51:45
1)Create a Base class definition that includes:
a private variable String label
a no-args constructor that initializes label to "default"
a String constructor that initializes label to the passed argument
a public String getLabel() method
2)Create a First class definition that extends Base and includes:
a private variable int distance
a no-args constructor that initializes distance to 90
an int constructor that initializes distance to the passed argument
a String getDistance() method that returns "distance=" and the distance
3)Experiment with adding additional constructors to First that allow it to call the constructor of Base that takes a String argument
Easy to write this:
if (args.length > 0)
myFirst = new First( args[0] );
else myFirst = new First();

1)生成一个基类Base,其定义包括:
一个私有String变量:label
一个无参数的构造器,初始化变量label为"default"
一个带String参数的构造器,用传递的参数初始化label变量
一个公有方法getLabel,返回类型为String
2)生成一个First类,其继承Base类,具体定义如下:
一个私有int变量:distance
一个无参数的构造器,初始化变量distance为"90"
一个带int参数的构造器,用传递的参数初始化distance变量
一个返回类型为String的公有方法getDistance,,返回值为"distance="+distance
3)给First类添加附加的构造器,使其能调用基类Base的能接收参数的构造器,以便能使用如下代码:
if (args.length > 0)
myFirst = new First( args[0] );
else myFirst = new First();