
3.20 Java Basics and Control Loops
}
else // associated with outer if
{ …else block………}
Example 3.10: IfLoop.java To Test the if Control Loop
//IfLoop.java to test the if loop
1. package com.oops.chap3;
2. public class IfLoop {
3. public static void main(String[] args) {
4. //Declare two arrays to hole marks and attendance of 5 stu-
dents
5. int[] idNo = new int[]{ 50595, 50596,50597,50598,50599};
6. float[] marks = new float[]{96.0F,65.8F,71.0F,46.0F,33.0F};
7. float[] att = new float[]{78.0F,66.0F,71.0F,75.0F,45.0F};
8. boolean [] yesno = new boolean[5];
9. for ( int i=0; i<5;i++)yesno[i]=false; //initial value for
yesno
10. // To be eligible ...