|
01 packagepackage is used to name the directory or folder a class is in intro;
02 //start auto-imports
03 importimport means to make the classes and/or packages available in this program java.io.*;
04 importimport means to make the classes and/or packages available in this program java.util.*;
05 //end auto-imports
06
07 importimport means to make the classes and/or packages available in this program wiki.Wiki;
08
09 /**
10 * All about my application.
11 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
12 */
13 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects MazeTextExample
14 {open braces start code blocks and must be matched with a close brace
15 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) voidvoid means the method does not return a value mainThe main method is the place where applications begin executing.(String[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays args)
16 {open braces start code blocks and must be matched with a close brace
17 System.out.println("Maze:");
18 Scanner scanner=this assignment operator makes the left side equal to the right sidenullnull is the value used to refer to a non-existant object;
19 trytry is for executing a code block that may experience exceptions (errors)
20 {open braces start code blocks and must be matched with a close brace
21 scanner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Scanner(Wiki.getInputStream("Maze2.txt"));
22 }close braces end code blocks and must match an earlier open brace
23 catchcatch means to handle an exception that may occur(IOException e)
24 {open braces start code blocks and must be matched with a close brace
25 System.out.println("Had problems making scanner: "+adds two numbers together or concatenates Strings togethere);
26 }close braces end code blocks and must match an earlier open brace
27 intint is the type for whole numbers and it is short for integer rows=this assignment operator makes the left side equal to the right sidescanner.nextInt();
28 intint is the type for whole numbers and it is short for integer cols=this assignment operator makes the left side equal to the right sidescanner.nextInt();
29 charchar is the type for a single letter or symbol and it is short for character[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays maze=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor charchar is the type for a single letter or symbol and it is short for character[brackets are typically used to declare, initialize and index (indicate which element of) arraysrows]brackets are typically used to declare, initialize and index (indicate which element of) arrays[brackets are typically used to declare, initialize and index (indicate which element of) arrayscols]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
30 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer r=this assignment operator makes the left side equal to the right side0; r<rows; r++this is the increment operator, which increases the variable by 1)
31 {open braces start code blocks and must be matched with a close brace
32 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer c=this assignment operator makes the left side equal to the right side0; c<cols; c++this is the increment operator, which increases the variable by 1)
33 {open braces start code blocks and must be matched with a close brace
34 maze[brackets are typically used to declare, initialize and index (indicate which element of) arraysr]brackets are typically used to declare, initialize and index (indicate which element of) arrays[brackets are typically used to declare, initialize and index (indicate which element of) arraysc]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right sidescanner.next().charAt(0);
35 }close braces end code blocks and must match an earlier open brace
36 }close braces end code blocks and must match an earlier open brace
37 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer r=this assignment operator makes the left side equal to the right side0; r<rows; r++this is the increment operator, which increases the variable by 1)
38 {open braces start code blocks and must be matched with a close brace
39 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer c=this assignment operator makes the left side equal to the right side0; c<cols; c++this is the increment operator, which increases the variable by 1)
40 {open braces start code blocks and must be matched with a close brace
41 System.out.print(maze[brackets are typically used to declare, initialize and index (indicate which element of) arraysr]brackets are typically used to declare, initialize and index (indicate which element of) arrays[brackets are typically used to declare, initialize and index (indicate which element of) arraysc]brackets are typically used to declare, initialize and index (indicate which element of) arrays+adds two numbers together or concatenates Strings together" ");
42 }close braces end code blocks and must match an earlier open brace
43 System.out.println();
44 }close braces end code blocks and must match an earlier open brace
45
46 //while(scanner.hasNext())
47 //{
48 // String token=scanner.next();
49 // System.out.println("Read in: "+token);
50 //}
51 }close braces end code blocks and must match an earlier open brace
52 }close braces end code blocks and must match an earlier open brace
|