Solved

What Is Incorrect in the Following Code Snippet

Question 43

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents