Skip to content

Commit

Permalink
bed
Browse files Browse the repository at this point in the history
  • Loading branch information
tonydattolo committed Jan 16, 2020
1 parent f6a3d87 commit d00cf8f
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .vscode/launch.json
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"
}
]
}
49 changes: 49 additions & 0 deletions BookProblems/Week1_class2.java
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(" ----- " + " (_|_) ");
}

}

11 changes: 11 additions & 0 deletions HelloWorld.java
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");
}
}
53 changes: 53 additions & 0 deletions PrincetonJava/Booknotes/Chapter1.txt
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
11 changes: 11 additions & 0 deletions PrincetonJava/HelloWorld.java
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!");
}
}
13 changes: 13 additions & 0 deletions PrincetonJava/UseArgument.java
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?");
}
}

0 comments on commit d00cf8f

Please sign in to comment.