Created
November 6, 2017 16:55
-
-
Save arialdomartini/62d48191bd2c1c9fcaf4707c2a2e05f2 to your computer and use it in GitHub Desktop.
guido-was-right.java
This file contains hidden or 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
public class Exercise2 { | |
public static void main(String[] args) { | |
int nums[] = new int[]{1, 2, 42, 4, 5, 6}; | |
boolean value = SecretOfLife.lookFor(nums); | |
System.out.println(value); | |
} | |
static class SecretOfLife { | |
public static boolean lookFor(int[] nums) { | |
double result = 0; | |
for (int i : nums) { | |
if (i == 42) { | |
System.out.println("Found!"); | |
return true;} | |
} | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment