Overview Lesson #2
Below is a list of all the lessons this overview lesson will cover.
- The Scanner Class
- Arrays
- Foreach Loops
- The Math Class
- Errors/Exceptions
- Methods
- Advanced Methods
Lesson Quiz
Each question in this quiz corresponds to that lesson, so if you miss a specific problem, go back to that problem’s lesson to review.
1. What is the correct syntax of creating a variable s of type Scanner, reading input from the console?
2. Which signature line is for a method with three int parameters( a, b, c ), returns a String, has a name “method1”, and should not be accessed outside of the class.
3. Which is the proper way of declaring a three dimensional int array of dimensions 5x5x5?
4. What is the syntax of a foreach loop which traverses a one dimensional String array, “ar”, of length 7?
5. What is the result of the below statement?
Math.abs(-1 * Math.sqrt(3 * Math.pow(3, 3)))
6. What will occur from the following code?
int a = 1;
while (a != 0) {
a *= 4;
}
7. Will an exception be thrown from the following method declarations?
public void method1() {...}
public void method1(int a) {...}
Written by James Richardson
Notice any mistakes? Please email us at learn@teamscode.com so that we can fix any inaccuracies.