正在加载图片...
The switch statement int gradelevel gradelevel inputBox. getInteger(Grade (Frosh-1, Soph-2 switch (gradelevel) i This statement is executed if case 1: outputBox. printLine("Go to the Gymnasium")i the gradeLevel is equal to 1 case 2: outputBox printline ("Go to the Science Auditorium")i ase 3: outputBox printline(" Go to Harris Hall Rm A3) breaki This statement is executed if case 4: outputBox printline("Go to Bolt Hall Rm 101)i the gradeLevel breaki is equal to 4 C 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 6-24© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 6 - 24 The switch Statement int gradeLevel; gradeLevel = inputBox.getInteger("Grade (Frosh-1,Soph-2,...):" ); switch (gradeLevel) { case 1: outputBox.printLine("Go to the Gymnasium"); break; case 2: outputBox.printLine("Go to the Science Auditorium"); break; case 3: outputBox.printLine("Go to Harris Hall Rm A3"); break; case 4: outputBox.printLine("Go to Bolt Hall Rm 101"); break; } This statement is executed if the gradeLevel is equal to 1. This statement is executed if the gradeLevel is equal to 4
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有