2021-04-14

package cn.zhangjiamiao.jz;

class Person{

int age;

int No;

String name;

public Person() {

System.out.println("无参的构造方法被调用了!");

}

public Person(String name,String a) {

System.out.println(name+"说了"+a);

}

public Person(int a,int n) {

age=a;

No=n;

}

public void Run(String name,String Dz) {

System.out.println(name+"开始"+Dz);

}

public void output() {

System.out.println("张三年龄是"+age+"学号:"+No);

}

}

public class Zhangjiamiao {

public static void main(String[] args) {

Person p=new Person("张三","三餐干饭");

Person p1=new Person(19,190);

Person run=new Person();

p1.output();

}

}

你可能感兴趣的:(2021-04-14)