• 2021-04-14 问题

    classCount{publicintcount;publicCount(intc){count=c;}publicCount(){count=1;}}publicclassTest{publicstaticvoidincrement(Countc,inttimes){c.count++;times++;}publicstaticvoidmain(Stringargs[]){CountmyCount=newCount();inttimes=0;for(inti=0;i<3;i++)increment(myCount,times);System.out.println("myCount.count="+myCount.count+"times="+times);}}程序的运行结果正确的是()

    classCount{publicintcount;publicCount(intc){count=c;}publicCount(){count=1;}}publicclassTest{publicstaticvoidincrement(Countc,inttimes){c.count++;times++;}publicstaticvoidmain(Stringargs[]){CountmyCount=newCount();inttimes=0;for(inti=0;i<3;i++)increment(myCount,times);System.out.println("myCount.count="+myCount.count+"times="+times);}}程序的运行结果正确的是()

  • 1