java定义类的方法类型有哪些

定义数据类型为字符串、私有成员变量MathAutor和MathCompany为这两个变量分别定义Getxxx和Setxxx方法提供外部访问

public class Demo {
    private String MathAutor;
    private String MathCompany;

    public String getMathAutor() {
        return MathAutor;
    }

    public void setMathAutor(String mathAutor) {
        MathAutor = mathAutor;
    }

    public String getMathCompany() {
        return MathCompany;
    }

    public void setMathCompany(String mathCompany) {
        MathCompany = mathCompany;
    }
}