📄 mankind.java
字号:
//c4:Mankind.java
//author:ZhangHongbin
//This program is protected by copyright laws.
//a widely used class example in my book.
public class Mankind
{
int sex;
int salary;
void name()
{
System.out.println("My Name is abc");
}
void income(int wage)
{
System.out.println("My income this year is "+wage);
}
public static void main(String[] args)
{
Mankind somePerson=new Mankind();//创建对象
somePerson.sex=1;//给对象中的数据赋值
somePerson.salary=5; //给对象中的数据赋值
somePerson.name();//执行对象中的方法
somePerson.income(200); //执行对象中的方法
System.out.println("My salary this month is "+somePerson.salary);//输出域的值
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -