What is incorrect in the following code snippet?
Public static void textInRectangle(String str)
{
System.out.println("--------") ;
System.out.println("|" + str + "|") ;
System.out.println("--------") ;
}
Public static void main(String[] args)
{
System.out.println(textInRectangle("Hello there") ;
}
A) textInRectangle is called with incorrect arguments.
B) textInRectangle should be called in an assignment statement.
C) The return value from textInRectangle is never used.
D) textInRectangle does not return a value; therefore, it cannot be used with System.out.println
Correct Answer:
Verified
Q38: What are the values of num1 and
Q39: What is the output of the following
Q40: What can be used as an argument
Q41: What step should you take after implementing
Q42: Given the following code, what is the
Q44: Given the following code, which argument(s) will
Q45: What is wrong with the following code?
Public
Q46: Which of the following is the best
Q47: What is wrong with the following code?
Public
Q48: Which of the following is true about
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents