package cc.openhome;
class Clothes2{
String color;
char size;
//构造函数
Clothes2(String a,char b)
{
this.color=a;
this.size=b;
}
}
主函数部分
public class Field2 {
public static void main(String[] args) {
Clothes2 sun=new Clothes2("Green",'S');
Clothes2 spring=new Clothes2("red",'M');
Clothes2 sun2=new Clothes2("Green",'S');
//如果不需要分号则用println();输出
System.out.printf("%s,%c%n",sun.color,sun.size);
System.out.printf("%s,%c%n",spring.color,spring.size);
}
}