菜鸟问题
public class P309 {
String subName;
int salary;
int totalBooks;
public P309(String subName,int totalBooks) {
this.subName=subName;
this.totalBooks=totalBooks;
}
void calculateHrs(){
salary=this.totalBooks*2;
}
public static void main(String[] args) {
}
}
class Science{
Science(){
P309 good = new P309("科学",10);
good.calculateHrs();
System.out.println(good.subName+"学科的总时数是"+good.salary);
}
}
class Arts{
Arts(){
P309 good = new P309("艺术",14);
good.calculateHrs();
System.out.println(good.subName+"学科的总时数是"+good.salary);
}
}
我现在要在P309中调用 Science() 和 Arts() 怎么调?.
在线等。...