import java.util.Scanner; class Person { String name; char sex; int age; String IdCard; public void printf() { System.out.print("姓名是:"+name+" "); System.out.print("性别是:"+sex+" "); System.out.print("年龄是:"+age+" "); System.out.println("身份证号码是:"+IdCard); } }
1 import java.util.Scanner; 2 class Phone 3 { 4 String Phonebrand;
String Phonemodel; 6 public void printf() 7 { 8 System.out.print("该手机的品牌是:"+Phonebrand+" "); 9 System.out.println("手机型号是:"+Phonemodel); 10 } 11 12 public Phone(String Phonebrand,String Phonemodel) 13 { 14 this.Phonebrand=Phonebrand; 15 this.Phonemodel=Phonemodel; 16 } 17 }
老师,我只会弄到这个地方。