Last active
March 5, 2022 03:08
-
-
Save werterzz/dfb0223c4e98b65092dba8f7f11a8c09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<String> basket = Arrays.asList("orange", "apple", "orange", "orange", "apple"); | |
int appleCount = 0; | |
for (String obj : basket) { | |
if (obj.equals("apple")) appleCount++; | |
} | |
System.out.println("There are " + appleCount + " apples in the basket."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment