0
Display all true boolean values
How do I display all True values? public class arg{ public static void main (String[]arg){ boolean[] correct= new boolean[6]; correct[0]= true; correct[2]= true; correct[3]= false; correct[4]= true; correct[5]= false; } } Output: 3
1 Answer
0
Declare a count variable.
Run a for loop.
Check if correct[i] == true.
If true then increment the count.
Print the count at the end.