📄 kids4.java
字号:
//c4: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();//创建Mankind对象
Kids4 someKid=new Kids4();//创建Kids对象
someKid.mySalary1=1000;//给Kids对象中的数据赋值
someKid.mySalary2=somePerson.employed(someKid.mySalary1);//用Kids对象的数据调用Mankind对象的方法,并把结果返回给Kids的数据。
System.out.println("boss promise i can get "+someKid.mySalary1);
System.out.println("but he only give me "+someKid.mySalary2); //执行对象中的方法
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -