From ggc
|
01 importimport means to make the classes and/or packages available in this program java.util.*;
02 /**
03 * All about my application here.
04 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
05 */
06 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 TypesAndVariables
07 {open braces start code blocks and must be matched with a close brace
08 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)
09 {open braces start code blocks and must be matched with a close brace
10 String lastName;//declaring
11 lastName=this assignment operator makes the left side equal to the right side"Jenkins";//initializing
12 intint is the type for whole numbers and it is short for integer middleName;
13 middleName=this assignment operator makes the left side equal to the right side45;
14 System.out.println("Hello " +adds two numbers together or concatenates Strings together middleName +adds two numbers together or concatenates Strings together " " +adds two numbers together or concatenates Strings together lastName +adds two numbers together or concatenates Strings together ".");
15 charchar is the type for a single letter or symbol and it is short for character letter=this assignment operator makes the left side equal to the right side'g';
16 System.out.println(letter);
17
18 System.out.println("What is your name?");
19 Scanner scanner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Scanner(System.in);
20 String yourName=this assignment operator makes the left side equal to the right sidescanner.next();
21 System.out.println("Hello "+adds two numbers together or concatenates Strings togetheryourName);
22 }close braces end code blocks and must match an earlier open brace
23 }close braces end code blocks and must match an earlier open brace
|
Download/View TypesAndVariables.java