|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我在运行写的程序的时候,排除了程序里的bug,但是点击运行的时候控制台还是停留在上一次运行的结果,请问应该怎么操作
- package Teacher;
- public class Teacher {
- String name;
- int age;
- double salary;
- String sex;
- public Teacher() {
- }
- public Teacher(String name,int age,double salary,String sex){
- this.name=name;
- this.age=age;
- this.salary=salary;
- this.sex=sex;
- }
- void addSalary(){
- this.salary=this.salary+5000;
- }
- }
- class TeacherText {
- public static void main(String[] args) {
- Teacher teacher=new Teacher();
- teacher.name="zdx";
- teacher.age=20;
- teacher.salary=8965;
- teacher.sex="男";
- System.out.println("年龄:"+teacher.age);
- System.out.println("姓名:"+teacher.name);
- System.out.println("性别:"+teacher.sex);
- System.out.println("原有薪水:"+teacher.salary);
- teacher.addSalary();
- System.out.println("现在薪水:"+teacher.salary);
- }
- }
复制代码
【找不到在哪传图片,抱歉啦】 |
|