正在加载图片...
The Nested-if statement r The then and else block of an if statement can contain any valid statements including other if statements. An if statement containing another if statement is called a nested-if statement f (testscore >=70)( if (studentAge 10) i messageBox. show("You did a great job )i e⊥se messageBox. show("You did pass")i //test score >=70 //and age >=10 else( //test score <70 messageBox. show("You did not pass") C 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 6-14© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 6 - 14 The Nested-if Statement The then and else block of an if statement can contain any valid statements, including other if statements. An if statement containing another if statement is called a nested-if statement. if (testScore >= 70) { if (studentAge < 10) { messageBox.show("You did a great job"); } else { messageBox.show("You did pass"); //test score >= 70 } //and age >= 10 } else { //test score < 70 messageBox.show("You did not pass"); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有