分析下面的程序,写出运行结果。classExercises6_3{classDog{privateStringname;privateintage;publicintstep;Dog(Strings,inta){name=s;age=a;step=0;}publicvoidrun(Dogfast){fast.step++;}}publicstaticvoidmain(Stringargs[]){Exercises6_3a=newExercises6_3();Dogd=a.newDog("Tom",3);d.step=29;d.run(d);System.out.println(""+d.step);}}运行结果是:()
举一反三
- 运行下列程序,会产生什么结果?()1)publicclassExercises3_1extendsThreadimplementsrunable{2)publicvoidrun(){3)System.out.println("thisisrun()");4)}5)publicstaticvoidmain(Stringargs[]){6)Threadt=newThread(newExercises3_1());7)t.start();8)}9)}
- step1: _________ ____________step 2: ____________step 3: ____________step4: ____________ ___________step 5: ____________step6: ____________step 7: ____________What's more: ___________
- 假定有以下程序段n=0for i=1 to 6 step 2 for j=4 to 1 step -1 n=n+1 next jnext i运行完毕后,n的值是______。 A: 0 B: 3 C: 4 D: 12
- 下面的VBA程序段运行时,内层循环的循环次数是( )。 For a= 0 to 7 step 3 For b=a-1 to a+1 step 2 Next b Next a A: 6 B: 7 C: 8 D: 5
- 下列程序段的执行结果是______。 i=0 For j = 10 To 19 Step 3 i=i+1 Next j Print I A: 4 B: 5 C: 3 D: 6