Java Programming, Loose-leaf Version
8th Edition
ISBN: 9781337685917
Author: Joyce Farrell
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 3, Problem 6RQ
Program Description Answer
The correct method call for the declared method public static void aMethod(char code) is “aMethod('Q')”.
Hence, the correct answer is option “D”.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Which of the following is true for a method have int return type?
a)The method can have only one return statement within one-way if
b)The method having only return statement within if must be two-way
c)The method need not have a return statement
d)The return statement should not be within if
Which of the following will compile successfully?
1.)
public int methodC() {
return;
}
2.)
public int methodC() {
return 0;
}
3.)
public void methodA() {
return null;
}
4.)
public int methodB() {
return 9.0;
}
Suppose you have declared a variable as int myAge = 21;. Which of the following is a legal call to a method with the following declaration?private static void AMethod(int num)
a. AMethod(myAge);
b. AMethod(int myAge);
c. AMethod();
d. AMethod(int 55);
Chapter 3 Solutions
Java Programming, Loose-leaf Version
Ch. 3 - Prob. 1RQCh. 3 - Prob. 2RQCh. 3 - Prob. 3RQCh. 3 - Prob. 4RQCh. 3 - Prob. 5RQCh. 3 - Prob. 6RQCh. 3 - Prob. 7RQCh. 3 - Prob. 8RQCh. 3 - Prob. 9RQCh. 3 - Prob. 10RQ
Ch. 3 - Prob. 11RQCh. 3 - Prob. 12RQCh. 3 - Prob. 13RQCh. 3 - Prob. 14RQCh. 3 - Prob. 15RQCh. 3 - Prob. 16RQCh. 3 - Prob. 17RQCh. 3 - Prob. 18RQCh. 3 - Prob. 19RQCh. 3 - Prob. 20RQCh. 3 - Prob. 1PECh. 3 - Prob. 2PECh. 3 - Prob. 3PECh. 3 - Prob. 4PECh. 3 - Prob. 5PECh. 3 - Prob. 6PECh. 3 - Prob. 7PECh. 3 - Prob. 8PECh. 3 - Prob. 9PECh. 3 - Prob. 10PECh. 3 - Prob. 11PECh. 3 - Prob. 12PECh. 3 - Prob. 13PECh. 3 - Prob. 1GZCh. 3 - Prob. 2GZCh. 3 - Prob. 1CP
Knowledge Booster
Similar questions
- Which of the options below is correct for myMethod having return type as double. It is invoked in main method as int a = myMethod(); ? a)There is no error b)Declaration of a must be double as return type is double c)There must be at least one parameter d)Declaration and invocation must be on separate linesarrow_forward2.Which of the following is the correct way to define an initializer method? A. def __init__(title, author): B. def __init__(): C. __init__(self, title, author): D. def __init__(self, title, author):arrow_forwardWhich of the following will compile successfully? 1.) void final methodD(){} 2.) public final int void methodB() {} 3.) private void int methodC() {} 4.) final static void methodA() {}arrow_forward
- Which constructor among the following will be called if a call is made like className(5,’b’);? a) className(int x=5,char c=’b’); b) int className(int x, char c, char d); c) className(int x, char c, int y); d) char className(char c,int x);arrow_forwardWhich of the following pairs of method declarations represent correctly overloaded methods? a. private static void MethodB(double d) private static void MethodB() b. private static double MethodC(int e) private static double MethodD(int f) c. Two of these are correctly overloaded methods. d. private static void MethodA(int a) private static void MethodA(int b, double c)arrow_forwardWhich of the following statements are true about static methods.? Static methods do not need an object in a class to be invoked. Math.sin(x) is an example of a static method. Inside a class, a static method belonging to the class can be invoked by using its name. Outside a class, a static method is invoked by using the name of the class - like Math,pow. All of the above are true statements about static methods.arrow_forward
- Which of the following is false? a)There can be more than one parameter for a method b)There can be more than one return type for a method c)There can be zero or one return type for a method d)There can be zero or one parameter for a methodarrow_forwardWhich of the following statements correctly shows the first line of a method definition? A. class method display(self): B. method display(self): C. display(self): D. def display(self):arrow_forwardWhich of the following pairs of method declarations represent correctly overloaded methods? a. private static void Method(double d) private static int Method() b. Two of these are correctly overloaded methods. c. private static double Method(int e) private static int Method(int f) d. private static void Method(int a) private static void Method(int b)arrow_forward
- Which of the following is the correct way to set up the header for a method called timesTen that takes in an integer and returns a double? public static double timesTen(int number1, int number2) public static int timesTen(double number) public static timesTen(int number1, double number2) public static double timesTen(int number) in javaarrow_forwardGiven the following method, which line of code correctly calls the method and copies the returned value into the memory of a local variable? (Assume all variables used have already been declared and initialized). public static double difference(double a, double b){ return abs(a-b);} Options: difference(x,y); diff = difference(double x, double y); double difference(double a, double b) diff = difference(x,y);arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage