Question
1. What should the return value type of the following method be? public static __________ myMethod(int num1, int num2) { System.out.println(hello!! :));
1. What should the return value type of the following method be?
public static __________ myMethod(int num1, int num2) {
System.out.println("hello!! :)");
return num1 + num2;
}
A. void
B. String
C. double
D. int
E. None of these choices are correct.
F. boolean
G. char
2. Which of the following values are valid for the return value type?
(Check all that apply.)
A. void
B. return
C. static
D. char
E. boolean[]
F. double
G. String
3. How many arguments and parameters are there for exampleMethod?
public static void main(String[] args) {
String name = "Nikki";
int age = 100;
Scanner input = exampleMethod(name, age);
System.out.println("Hello! Please enter your name:");
name = input.nextInt();
System.out.print("Nice to meet ya, " + name + "! :)");
}
public static Scanner exampleMethod(String default1, int default2) {
Scanner reader = new Scanner(System.in);
System.out.println("Alert! Alert! Right now the default values " +
"in your program are:\tName: " + default1 +
"\tAge: " + default2);
System.out.println("Make sure to get new values from the user. :)");
return reader;
}
There is/are______ argument(s).
There is/are______ parameter(s).
4. I want to write a method that will translate an English word into an Arabic word. I will pass the method a word in English and it will search through a big array of English words until it finds the same word. It will take note of the index number, then look up the same index number in a big array of Arabic words, which will produce the translation of the word into Arabic. The method will then return the translated Arabic word. How many parameters should I have?
A. 0
B. 1
C. 2
D. 3
E. None of these choices, because you can't write a method to do this.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
1Answer D int 2Valid Return ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started