diff --git a/out/production/java_practice/Numpad.class b/out/production/java_practice/Numpad.class new file mode 100644 index 0000000..d11ff8d Binary files /dev/null and b/out/production/java_practice/Numpad.class differ diff --git a/practice_projects/src/Numpad.java b/practice_projects/src/Numpad.java new file mode 100644 index 0000000..7628cf5 --- /dev/null +++ b/practice_projects/src/Numpad.java @@ -0,0 +1,25 @@ +public class Numpad { + + public static void main(String[] args){ + // This project is to show how to use 2D Arrays + // a.k.a. Nested arrays (an array of arrays) + + // 2D arrays are useful for storing a matrix of data. + + + // Remember - Characters are single quotes 'C' + char[][] numpad = {{'1', '2', '3'}, + {'4', '5', '6'}, + {'7', '8', '9'}, + {'*', '0', '#'}}; + + // We need nested loops to print columns and rows + for(char[] row : numpad){ + for(char number : row){ + System.out.print(number + " "); + } + // Between every row add an empty line + System.out.println(); + } + } +}