movies类
/\
/ \
disc类 VHS tape类
/ \
VCD类 DVD类
每个类都有movies 和 movies信息。
问题1:假如要加一个play(),应该放到那个类?你昨天说了是movies类,但不应该在所有类里都放么?
问题2:加这个play(),是否像是用重载?
问题3:哪些类要用重载?
问题4:假如要加一个burnCopy(),用来刻录电影的方法,这个方法从disc上读取数码信息来刻录,那么应该在哪定义这个方法呢?是不是需要用到重载?
public class BankAccount
{
private double balance;
public BankAccount(double initBalance)//括号里的这个?
{
balance = initBalance;//还是这个?
}
}
public class SavingsAccount extends BankAccount
{
double interestRate;
public SavingsAccount(double initRate,double initBalance)
{
super(initBalance); //这个super()里面参数指的是上面的哪个?
interestRate = initRate;
}
}
super()括号里一定是放参数么?放数目字可以么?什么情况下放数目字?当我们想赋予initBalance一个值时?
例如super(2),代表initBalance = 2?等于 BankAccount a = new BankAccount(2)?
String[] quoteOne = {"Facts","are","the","enemy","of","truth"};
String[] quoteTwo = {"Glory","is","fleeting","Obscurity","is","forever"};
for(int i=0;i<6;i++)// 里面的6可以换成i<quoteOne.length么?
{
String ss=quoteOne[i];
quoteOne[i]=quoteTwo[i];
quoteTwo[i]=ss;
}
谢谢~