麻烦帮忙找一下这段代码中错误

package day05;
//需求:定义类并测试;
public class Demo06 {
    public static void main(String[] args) {
        Student stu1=new Student("张三",88);
        stu1.introduce();

        Student stu2=new Student();

        stu2.setName("李四”);

        stu2.setScore(96);

        stu2


.introduce();

    }
}

class Student{
    String name;
    int score;
    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name=name;
    }
    public int getScore(){
        return score;
    }
    public void setScore(int score){
        this.score=score;
    }
    Student(){
        System.out.println("无参的构造方法被执行了!");
    }
    Student(String name,int score){
        this.name=name;
        this.score=score;
    }
    public void introduce(){
        System.out.println("大家好,我叫"+name+"我考了"+score+"分!");
    }
}

TryLee
浏览 1342回答 3
3回答

慕容慕

789行中文符号的问题

深白

除了中文的“和()这些符号外,我这里运行结果正确。

erutdioup8556

看不到
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java