
4-6可以讲一下嘛谢谢了
关注【Python代码】
class CLASS(object):
def __init__(self, specialty,myclass):
self.specialty = specialty # 实例属性
self.myclass = myclass # 实例属性
def intro1(self):
print("我来自{}专业{}班。".format(self.specialty,self.myclass))
my = CLASS("电子信息",2)
my.intro1()

【JAVA代码】
public class Test {
public static void main(String[] args) {
CLASS my = new CLASS();
my.specialty = "电子信息";
my.myclass = 2;
my.intro1();
}
}
class CLASS
{
public String specialty;
public int myclass;
public void intro1()
{
System.out.println("我来自"+ this.specialty + "专业"+ this.myclass + "班。" );
}
}
