-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6a3d87
commit d00cf8f
Showing
6 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "java", | ||
"name": "Debug (Launch) - Current File", | ||
"request": "launch", | ||
"mainClass": "${file}" | ||
}, | ||
{ | ||
"type": "java", | ||
"name": "Debug (Launch)-Week1_class2<H212_87e1e728>", | ||
"request": "launch", | ||
"mainClass": "BookProblems.Week1_class2", | ||
"projectName": "H212_87e1e728" | ||
}, | ||
{ | ||
"type": "java", | ||
"name": "Debug (Launch)-HelloWorld<H212_87e1e728>", | ||
"request": "launch", | ||
"mainClass": "HelloWorld", | ||
"projectName": "H212_87e1e728" | ||
}, | ||
{ | ||
"type": "java", | ||
"name": "Debug (Launch)-HelloWorld<H212_87e1e728>(1)", | ||
"request": "launch", | ||
"mainClass": "PrincetonJava.HelloWorld", | ||
"projectName": "H212_87e1e728" | ||
}, | ||
{ | ||
"type": "java", | ||
"name": "Debug (Launch)-UseArgument<H212_87e1e728>", | ||
"request": "launch", | ||
"mainClass": "PrincetonJava.UseArgument", | ||
"projectName": "H212_87e1e728" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Page 24: R1.7, R1.8, R1.9 | ||
// Page 25: R1.13, R1.14, R1.19 | ||
// Page 26: E1.11, E1.15 | ||
// Page 27: E1.16, E1.17, E1.18 | ||
// Page 28: P1.3 | ||
package BookProblems; | ||
|
||
/** | ||
* Week1_class2 | ||
*/ | ||
public class Week1_class2 { | ||
|
||
// R1.7 | ||
public static void main(String[] args) { | ||
System.out.println("======"); | ||
System.out.println("39 + 3"); | ||
System.out.println(39 + 3); | ||
test(); | ||
// test2(); | ||
test3(); | ||
} | ||
// R1.8 | ||
public static void test() { | ||
System.out.println("======"); | ||
System.out.print("Hello"); | ||
System.out.println("World"); | ||
} | ||
|
||
// R1.9 compile time error: exception in thread "main" java: method print.. in type printstream not applicable for arguments (String, String) | ||
// public static void test2() { | ||
// System.out.println("Hello", "world"); | ||
// } | ||
|
||
// R1.13 | ||
|
||
// R1.14 | ||
// R1.19 | ||
|
||
public static void test3() { | ||
System.out.println("==============="); | ||
System.out.println(" ----- " + " /\\_/\\ "); | ||
System.out.println(" / holaa \\ " + " ( ' ' ) "); | ||
System.out.println("| junior > " + "( \\_/ ) "); | ||
System.out.println(" \\ coder!/ " + " | | | "); | ||
System.out.println(" ----- " + " (_|_) "); | ||
} | ||
|
||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* HelloWorld | ||
*/ | ||
public class HelloWorld { | ||
|
||
public static void main(String[] args) { | ||
System.out.println("Hello, World!"); | ||
System.out.println("H" + "\n" + "e" + "\n" + "l" + "\n" + | ||
"l" + "\n" + "o"); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
1.2 Built-in Data Types | ||
|
||
Basic types | ||
int | ||
double | ||
boolean | ||
char | ||
String | ||
|
||
Literals - the value | ||
|
||
Operators | ||
and: && | ||
or: || | ||
not: ! | ||
|
||
Identifiers - instances of a data type | ||
|
||
Variables - entity that holds value. static in java. | ||
|
||
Declaration Statement - double totalSum; | ||
|
||
Naming conventions - camelCase | ||
|
||
Constant Variables - constant values. use uppercase with underscores | ||
SPEED_OF_LIGHT | ||
|
||
Expressions - 4 * (x - 3) | ||
|
||
Operator Precedence - division, multiplication, addition, subtraction | ||
Left associativity - a - b - c == (a - b) - c | ||
|
||
Assignment Statements - initialize variable | ||
int a,b; | ||
a = 1; | ||
b = 2; | ||
int c = a + b; | ||
|
||
Inline initialization | ||
int x = 34; | ||
|
||
Characters and Strings | ||
|
||
char = 'a'; | ||
Escaped Characters | ||
\t tab | ||
\b backspace | ||
\n newline | ||
\r carriage return - returns cursor to the new line | ||
\f formfeed - similar to new page or page break | ||
\' single quote | ||
\" double quote | ||
\\ backslash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package PrincetonJava; | ||
|
||
/** | ||
* HelloWorld | ||
*/ | ||
public class HelloWorld { | ||
|
||
public static void main(String[] args) { | ||
System.out.println("Hello, World!"); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package PrincetonJava; | ||
|
||
/** | ||
* UseArgument | ||
*/ | ||
public class UseArgument { | ||
|
||
public static void main(String[] args) { | ||
System.out.print("Hi, "); | ||
System.out.print(args[1]); | ||
System.out.println(". How are you?"); | ||
} | ||
} |