File tree Expand file tree Collapse file tree 2 files changed +76
-1
lines changed Expand file tree Collapse file tree 2 files changed +76
-1
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,79 @@ Remember the rules for this are
6
6
- Try not to give up until you've given it a solid attempt
7
7
8
8
## Challenge 1
9
+
10
+ Edit the following program so that the output is zero.
11
+
12
+ ``` java
13
+ void main() {
14
+ // Only change this line
15
+ String [] words = { " Sam" , " I" , " Am" };
16
+ System . out. println(array. length);
17
+ }
18
+ ```
19
+
20
+ ## Challenge 2
21
+
22
+ Using only ` System.out.println ` and array accesses,
23
+ print ` hello world ` to the screen.
24
+
25
+ ``` java
26
+ void main() {
27
+ char [] letters = {
28
+ ' ' ,
29
+ ' h' ,
30
+ ' e' ,
31
+ ' l' ,
32
+ ' o' ,
33
+ ' w' ,
34
+ ' r' ,
35
+ ' d'
36
+ };
37
+
38
+ // Your code here
39
+ }
40
+ ```
41
+
42
+ ## Challenge 3
43
+
44
+ Without editing either the array declaration or the loop at the bottom,
45
+ make the output of this program ` 0 ` .
46
+
47
+ ``` java
48
+ void main() {
49
+ final int numbers = { 1 , 2 , 3 , 4 };
50
+
51
+ // -----------
52
+ // YOUR CODE HERE
53
+
54
+
55
+ // -----------
56
+ int total = 0 ;
57
+ int index = 0 ;
58
+ while (index < numbers. length) {
59
+ total += numbers[index];
60
+ index += 1 ;
61
+ }
62
+ System . out. println(total);
63
+ }
64
+ ```
65
+
66
+ ## Challenge 4
67
+
68
+ Make this program output ` bulbasaur ` without changing anything
69
+ above or below the marked areas.
70
+
71
+ ``` java
72
+ void main() {
73
+ char [] name = { ' b' , ' u' , ' l' , ' b' };
74
+
75
+ // -----------
76
+ // YOUR CODE HERE
77
+
78
+
79
+ // -----------
80
+ char [] toPrint = name;
81
+ System . out. println(toPrint);
82
+ }
83
+ ```
84
+
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments