Question: Which is the simplest expression that can be inserted at (1), so that the program prints the value of the text field from the Message
Which is the simplest expression that can be inserted at (1), so that the program prints the value of the text field from the Message class?

Select the one correct answer.
(a) text
(b) Message.text
(c) msg.text
(d) this.msg.text
(e) super.msg.text
(f) this.super.msg.text
// File: MyClass.java class Message { } // The message that should be printed: String text = "Hello, world!"; class MySuperclass { Message msg= new Message (); } public class MyClass extends MySuperclass { public static void main (String[] args) { MyClass object = new MyClass (); object.print (); } public void print () { System.out.println(/* (1) INSERT THE SIMPLEST EXPRESSION HERE */ ); }
Step by Step Solution
3.45 Rating (155 Votes )
There are 3 Steps involved in it
c The simplest way to print the message in the class Message would be to use msgtext The main ... View full answer
Get step-by-step solutions from verified subject matter experts
