Solved

Which of the Following Code Snippets Can Be Used for Defining

Question 65

Multiple Choice

Which of the following code snippets can be used for defining a method that does not return a value? The method should accept a string and then display the string followed by "And that's all folks!" on a separate line.


A) public static String displayMessage(String str)
{
System.out.println(str) ;
System.out.println("And that's all folks!") ;
}
B) public static void displayMessage(String str)
{
System.out.println(str) ;
System.out.println("And that's all folks!") ;
}
C) public static void displayMessage(String str)
{
System.out.println(str) ;
System.out.println("And that's all folks!") ;
Return str;
}
D) public static void displayMessage()
{
System.out.println(str) ;
System.out.println("And that's all folks!") ;
}

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