Solved

What Is the Problem with the Code Snippet Below

Question 3

Multiple Choice

What is the problem with the code snippet below?
Public class test02
{
Public static void main(String[] args)
{
System.out.println(cost(10, 4) ) ;
}
Public static void cost(int price, int reps)
{
For (int i = 0; i < reps; i++)
{
System.out.print(price) ;
}
Return;
}
}


A) The method cost is invoked with the wrong arguments
B) The method cost uses uninitialized variables
C) The method cost returns void and cannot be used as an expression in a print statement
D) The method cost must return an integer value

Correct Answer:

verifed

Verified

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