File tree Expand file tree Collapse file tree 14 files changed +72
-96
lines changed Expand file tree Collapse file tree 14 files changed +72
-96
lines changed Original file line number Diff line number Diff line change 1
1
package com .codefortomorrow .advanced .chapter14 .practice ;
2
2
3
-
4
3
/*
5
4
The file “numbers.txt” has 100 random numbers
6
5
(one on each line). Use file i/o to find the
Original file line number Diff line number Diff line change 1
1
package com .codefortomorrow .advanced .chapter14 .practice ;
2
2
3
-
4
3
/*
5
4
Practice: Use File I/O to compare two files lexicographically.
6
5
Lexicographical order is very similar to alphabetical order,
Original file line number Diff line number Diff line change 1
1
package com .codefortomorrow .advanced .chapter16 .solutions ;
2
2
3
- import java .util .LinkedList ;
4
3
import java .util .ArrayList ;
4
+ import java .util .LinkedList ;
5
5
6
6
/*
7
7
Using the methods outlined in the “Benefits of LinkedLists” section,
Original file line number Diff line number Diff line change 1
1
package com .codefortomorrow .advanced .chapter16 .solutions ;
2
2
3
- import java .util .LinkedList ;
4
3
import java .util .Arrays ;
4
+ import java .util .LinkedList ;
5
5
6
6
/*
7
7
Write a method which takes in a LinkedList of Strings
Original file line number Diff line number Diff line change 3
3
/**
4
4
* @author ArmeetJatyani
5
5
* March 2021
6
- *
7
- * You'll be writing your first ever comment today!
8
- * What we'll go over:
6
+ *
7
+ * You'll be writing your first ever comment today!
8
+ * What we'll go over:
9
9
* - single line comments
10
10
* - multi line comments
11
11
*/
12
12
13
- // a class is an "object" where we will place all our code inside
14
- public class Comments {
15
- // the main method (below) is the first thing that runs when your program is run
13
+ // a class is an "object" where we will place all our code inside
14
+ public class Comments {
15
+
16
+ // the main method (below) is the first thing that runs when your program is run
16
17
public static void main (String [] args ) {
17
18
// this is a single line comment, I can write anything here
18
19
// single line comments aren't run by Java!
@@ -22,17 +23,11 @@ public static void main(String[] args) {
22
23
* this is a multi
23
24
* line
24
25
* comment
25
- *
26
+ *
26
27
* It can span across multiple lines!
27
28
*/
28
29
29
30
// YOUR ASSIGNMENT: write 1 single-line comment and 1 multi-line comment on the lines below...
30
31
31
-
32
-
33
-
34
-
35
-
36
-
37
32
}
38
- }
33
+ }
Original file line number Diff line number Diff line change 3
3
/**
4
4
* @author ArmeetJatyani
5
5
* March 2021
6
- *
7
- * Welcome to Java!
6
+ *
7
+ * Welcome to Java!
8
8
* This may be your first ever java program!
9
9
* We'll begin your journey with the infamous Hello World program!
10
10
*/
11
11
12
- // a class is an "object" where we will place all our code inside
13
- public class HelloWorld {
12
+ // a class is an "object" where we will place all our code inside
13
+ public class HelloWorld {
14
+
14
15
// the main method (below) is the first thing that runs when your program is run
15
16
public static void main (String [] args ) {
16
17
// write code here (replace the "" with "Hello World!")
17
18
System .out .println ("" );
18
19
}
19
- }
20
+ }
Original file line number Diff line number Diff line change 3
3
/**
4
4
* @author ArmeetJatyani
5
5
* March 2021
6
- *
7
- * You'll be writing your first ever comment today!
8
- * What we'll go over:
6
+ *
7
+ * You'll be writing your first ever comment today!
8
+ * What we'll go over:
9
9
* - single line comments
10
10
* - multi line comments
11
11
*/
12
12
13
- // a class is an "object" where we will place all our code inside
14
- public class Comments {
15
- // the main method (below) is the first thing that runs when your program is run
13
+ // a class is an "object" where we will place all our code inside
14
+ public class Comments {
15
+
16
+ // the main method (below) is the first thing that runs when your program is run
16
17
public static void main (String [] args ) {
17
18
// this is a single line comment, I can write anything here
18
19
// single line comments aren't run by Java!
@@ -22,7 +23,7 @@ public static void main(String[] args) {
22
23
* this is a multi
23
24
* line
24
25
* comment
25
- *
26
+ *
26
27
* It can span across multiple lines!
27
28
*/
28
29
@@ -31,8 +32,8 @@ public static void main(String[] args) {
31
32
// Hi my name is Armeet!
32
33
33
34
/**
34
- * I like teaching Java, and
35
+ * I like teaching Java, and
35
36
* good luck on your journey!
36
37
*/
37
38
}
38
- }
39
+ }
Original file line number Diff line number Diff line change 3
3
/**
4
4
* @author ArmeetJatyani
5
5
* March 2021
6
- *
7
- * Welcome to Java!
6
+ *
7
+ * Welcome to Java!
8
8
* This may be your first ever java program!
9
9
* We'll begin your journey with the infamous Hello World program!
10
10
*/
11
11
12
- // a class is an "object" where we will place all our code inside
13
- public class HelloWorld {
12
+ // a class is an "object" where we will place all our code inside
13
+ public class HelloWorld {
14
+
14
15
// the main method (below) is the first thing that runs when your program is run
15
16
public static void main (String [] args ) {
16
17
// write code here (replace the "" with "Hello World!")
17
18
System .out .println ("Hello World!" );
18
19
}
19
- }
20
+ }
Original file line number Diff line number Diff line change 3
3
/**
4
4
* @author ArmeetJatyani
5
5
* March 2021
6
- *
6
+ *
7
7
* Print out the number of apples and oranges!
8
8
*/
9
9
10
- public class ApplesOranges {
10
+ public class ApplesOranges {
11
+
11
12
public static void main (String [] args ) {
12
13
// write your code here
13
-
14
+
14
15
// define an integer variable called numOranges with value 10 (line 15)
15
16
16
-
17
17
// define an integer variable called numApples with value 24 (line 18)
18
18
19
-
20
19
// print out number of oranges using variables, output: "I have 10 oranges." (line 21)
21
20
22
-
23
21
// print out number of apples using variables, output: "I have 24 apples." (line 24)
24
22
25
-
26
23
}
27
- }
28
-
24
+ }
Original file line number Diff line number Diff line change 3
3
/**
4
4
* @author ArmeetJatyani
5
5
* March 2021
6
- *
6
+ *
7
7
* Define different types of variables
8
8
*/
9
9
10
- public class VariableTypes {
10
+ public class VariableTypes {
11
+
11
12
public static void main (String [] args ) {
12
13
// write your code here
13
-
14
+
14
15
// define an integer variable on line 15
15
16
16
-
17
17
// define a float variable on line 18
18
18
19
-
20
19
// define a double variable on line 21
21
20
22
-
23
21
// define a boolean variable on line 24 (Hint: true/false)
24
22
25
-
26
23
// define a character variable on line 27
27
24
28
-
29
- // define a string variable on line 30
30
-
25
+ // define a string variable on line 30
31
26
32
27
}
33
- }
34
-
28
+ }
You can’t perform that action at this time.
0 commit comments