importjava.util.*;publicclassTest2{privateStringcaiName;privateintcaiNunber;privateintcaiManey;Test2(StringcaiName,intcaiNunber,intcaiManey){this.caiName=caiName;this.caiNunber=caiNunber;this.caiManey=caiManey;}publicStringgetCaiName(){returncaiName;}publicvoidsetCaiName(StringcaiName){this.caiName=caiName;}publicintgetCaiNunber(){returncaiNunber;}publicvoidsetCaiNunber(intcaiNunber){this.caiNunber=caiNunber;}publicintgetCaiManey(){returncaiManey;}publicvoidsetCaiManey(intcaiManey){this.caiManey=caiManey;}/***@paramargs*/publicstaticvoidmain(String[]args){//TODOAuto-generatedmethodstubTest2t1=newTest2("空心菜",1201,12);Test2t2=newTest2("白菜",1202,12);Test2t3=newTest2("菠菜",1203,12);Test2t4=newTest2("娃娃菜",1204,12);Scannersc=newScanner(System.in);intnumber=sc.nextInt();if(number==t1.caiNunber){System.out.println(t1.toString());}elseif(number==t2.caiNunber){System.out.println(t2.toString());}elseif(number==t3.caiNunber){System.out.println(t3.toString());}elseif(number==t4.caiNunber){System.out.println(t4.toString());}}@OverridepublicStringtoString(){return"Test2[caiName="+caiName+",caiNunber="+caiNunber+",caiManey="+caiManey+"]";}}