题目内容
(6-9)请阅读程序,写出程序运行结果。classPhone{privateStringname;privateintprice;publicPhone(Stringname,intprice){this.name=name;this.price=price;}publicStringtoString(){return""+this.price;}}publicclassPhoneDemo{publicstaticvoidmain(String[]args){StringBuffersb=newStringBuffer();Phone[]list=newPhone[3];list[0]=newPhone("华为",3000);list[1]=newPhone("小米8",4000);list[2]=newPhone("vivoR10",2300);for(Phonep:list)sb.append(p);System.out.println(sb.toString());}}
查看答案
搜索结果不匹配?点我反馈