CodeHS Java Methods Checks
What is a Javadoc? The reference guide to Java that is in the back of a textbook. A program that cures the bugs in your Java program. Data that gets passed into a method A comment that clearly states the functionality and usage of a class or method.
A comment that clearly states the functionality and usage of a class or method.
Why do we use methods in Java programming? Break down our program into smaller parts Avoid repeating code Make our program more readable All of the above
All of the above
Does the following code snippet have a run time error, compile time error, both, or neither? int x = 3 int y = 4; int sum = x + y; Run time error Compile time error Both Neither
Compile time error
Question: 2 Which exception will be thrown as a result of running this code snippet? String hello = "hello"; char last = hello.charAt(10); IndexOutOfBoundsException ArithmeticException IllegalArgumentException None
IndexOutOfBoundsException
What are parameters? The value that a method returns. The values that a method prints to the screen. The formal names given to the data that gets passed into a method. The type that is given to a variable.
The formal names given to the data that gets passed into a method.
What is a return value? The value that a method prints to the screen. The value that is inputted to a method. The value that a user inputs to a program. The value that a method outputs.
The value that a method outputs.
What will this method call output? public boolean someMethod(int number) { if(number % 2 == 0) { return true; } else { return false; } } someMethod(9990) false 0 "true" true
true