Created
December 17, 2016 18:45
-
-
Save drewhoener/32a5f278a74402390866b6ed9a734320 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
public static void createArray(){ | |
//Create our scanner | |
Scanner scanner = new Scanner(System.in); | |
//Formatting! Just to make it pretty. We read in an integer with the scanner. The program knows to wait until you enter one | |
System.out.print("Enter an Array Length: "); | |
int length = scanner.nextInt(); | |
//Create our array | |
int[] arr = new int[length]; | |
//Look over this and make sure you understand it. If you think you've got it, try to complete it for tomorrow. | |
for(int i = 0; i < length; i++){ | |
System.out.println("Enter a value for position [" + i + "]: "); | |
//read in a value and set it to the array | |
} | |
scanner.close(); | |
System.out.println("Your chosen values: "); | |
System.out.println(Arrays.toString(arr)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment