Question: What will be the result of compiling and running the following program? Select the one correct answer. (a) The program will fail to compile. (b)
What will be the result of compiling and running the following program?
![public class MyClass { public static void main (String [] args) {](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1706/9/3/7/51065bdcca69d6eb1706937506919.jpg)
Select the one correct answer.
(a) The program will fail to compile.
(b) The program will print mouse at runtime.
(c) The program will print cat at runtime.
(d) The program will print dog at runtime.
(e) The program will randomly print either cat or dog at runtime.
public class MyClass { public static void main (String [] args) { String a, b, c; buget c = new String ("mouse"); a = new String ("cat"); b = a; a = new String ("dog"); c = b; System.out.println (c);
Step by Step Solution
3.42 Rating (149 Votes )
There are 3 Steps involved in it
c Strings are objects The variables a b and c are referen... View full answer
Get step-by-step solutions from verified subject matter experts
