You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/bonuses/english/AboutArrays.java
+8-9Lines changed: 8 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -87,9 +87,9 @@ public class AboutArrays {
87
87
* Sometime, we would like to store a lot of values of the same type. Example: recording the battery level of a robot for every second during a 2m30s match (150 double values).
88
88
* Having 150 variable of type 'double' would be very cumbersome to manipulate in our program. Instead, we would like a single variable, of a type storing all 150 values at once.
89
89
*
90
-
* Such a type is called an 'array'. To create an array of type and n values, you can write:
90
+
* Such a type is called an 'array'. To create an array of values of type 'SomeType' with n values, you can write:
91
91
*
92
-
* SomeType[] someName = new SomeType[size];
92
+
* SomeType[] myArray = new SomeType[n];
93
93
*
94
94
* Ex:
95
95
*
@@ -125,7 +125,7 @@ public class AboutArrays {
125
125
/**
126
126
* # Last element of an array
127
127
*
128
-
* Write a method named 'first' with an array of integers 'array' as a parameter, which returns the last element of that array.
128
+
* Write a method named 'last' with an array of integers 'array' as a parameter, which returns the last element of that array.
129
129
*
130
130
* --------- TIPS --------------
131
131
*
@@ -209,7 +209,7 @@ public class AboutArrays {
209
209
*
210
210
* Write a method named 'min' with an array of integers 'array' as a parameter.
211
211
* It returns the smallest number within the array.
212
-
* If the array is empty, it should return -1.
212
+
* If the array is empty, it should return Integer.MAX_VALUE, which is the largest possible int.
213
213
*
214
214
* -------------------------------
215
215
*
@@ -235,7 +235,7 @@ public class AboutArrays {
235
235
*
236
236
* Using a 'for :' loop, write a method named 'min2' with an array of integers 'array' as a parameter.
237
237
* It returns the smallest number within the array.
238
-
* If the array is empty, it should return -1.
238
+
* If the array is empty, it should return Integer.MAX_VALUE, which is the largest possible int.
239
239
*
240
240
* --------- TIPS --------------
241
241
*
@@ -358,7 +358,7 @@ public class AboutArrays {
358
358
/**
359
359
* # Switch two elements
360
360
*
361
-
* Write a method named 'switch' with takes an array 'array' as a parameter.
361
+
* Write a method named 'switchFirst2' with takes an array 'array' as a parameter.
362
362
* If the array has 2 and only 2 elements, the method is switching them within the array.
0 commit comments