Insert the missing statement(s) in the following code fragment. The code is intended to display a message "Your cost is: " in a text area and display the cost on the next line.
Double cost = 500.99;
String message = "Your cost is:";
JTextArea result = new JTextArea(10, 30) ;
__________________________________________
Result.setEditable(false) ;
A) result.setText(message) ;
Result.append(cost) ;
B) result.addText(message + "\n" + cost) ;
C) result.append(message + cost) ;
D) result.setText(message + "\n") ;
Result.append(cost) ;
Correct Answer:
Verified
Q32: Consider the following code snippet:
Public static void
Q35: Consider the following code snippet:
Public static void
Q37: Which statements will create an editable text
Q38: What happens if a text field's width
Q39: An inner class can access local variables
Q41: An event listener for a button must
Q54: Which of the following statements about an
Q57: Consider the following code snippet:
Import _
Import java.awt.event.ActionListener;
/**
An
Q60: Consider the following code snippet: JFrame frame
Q71: Use the _ method to specify the
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