Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first task compete #4

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
java enhanced-loops
Muzzzo committed Mar 16, 2024
commit 8ad814b04b418d9c4ad5b3718bf6cc4c93513598
Binary file added _03_06/EnhancedForLoops.class
Binary file not shown.
11 changes: 11 additions & 0 deletions _03_06/EnhancedForLoops.java
Original file line number Diff line number Diff line change
@@ -8,13 +8,24 @@ public class EnhancedForLoops {
public static void main(String[] args) {
int[] primeNumbers = { 2, 3, 5, 7, 11, 13, 17, 19 };
// Write an enhanced for loop to print out each prime number in the array.
for(int prime:primeNumbers){
System.out.println(prime);
}

List<String> weekDays = Arrays.asList("Monday", "Tuesday", "Wednesday", "Thursday", "Friday");
// Write an enhanced for loop to print out each week day in the list.
for(String weekDay:weekDays){
System.out.println(weekDay);
}

int[] randomNumbers = { 23, 51, 72, 84, 1, 60, 34, 102 };
// Write an enhanced for loop to print out the numbers in the array that are
// greater than 50.
for(int rand:randomNumbers){
if (rand > 50){
System.out.println(rand);
}
}

}

Binary file added _03_07b/EnhancedForLoops.class
Binary file not shown.
11 changes: 11 additions & 0 deletions _03_07b/EnhancedForLoops.java
Original file line number Diff line number Diff line change
@@ -8,13 +8,24 @@ public class EnhancedForLoops {
public static void main(String[] args) {
int[] primeNumbers = { 2, 3, 5, 7, 11, 13, 17, 19 };
// Write an enhanced for loop to print out each prime number in the array.
for(int prime:primeNumbers){
System.out.println(prime);
}

List<String> weekDays = Arrays.asList("Monday", "Tuesday", "Wednesday", "Thursday", "Friday");
// Write an enhanced for loop to print out each week day in the list.
for(String weekDay :weekDays){
System.out.println(weekDay);

}
int[] randomNumbers = { 23, 51, 72, 84, 1, 60, 34, 102 };
// Write an enhanced for loop to print out the numbers in the array that are
// greater than 50.
for(int rand:randomNumbers){
if(rand > 50){
System.out.println(rand);
}
}

}