?? kids4.java
字號(hào):
//c3:Kids4.java
// author:ZhangHongbin
//This program is protected by copyright laws.
// use another class without extends.
class Mankind
{
float employed (int salaryValue)
{
return salaryValue*0.8f;
}
}
public class Kids4
{
int mySalary1;
float mySalary2;
public static void main(String[] args)
{
Mankind somePerson=new Mankind();//創(chuàng)建Mankind對(duì)象
Kids4 someKid=new Kids4();//創(chuàng)建Kids對(duì)象
someKid.mySalary1=1000;//給Kids對(duì)象中的數(shù)據(jù)賦值
someKid.mySalary2=somePerson.employed(someKid.mySalary1);//用Kids對(duì)象的數(shù)據(jù)調(diào)用Mankind對(duì)象的方法,并把結(jié)果返回給Kids的數(shù)據(jù)。
System.out.println("boss promise i can get "+someKid.mySalary1);
System.out.println("but he only give me "+someKid.mySalary2); //執(zhí)行對(duì)象中的方法
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -