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?

Select the one correct answer.
(a) The program will fail to compile.
(b) The program will compile, and print 1, 2, and 3 at runtime.
(c) The program will compile, and print 2, 3, and 1 at runtime.
(d) The program will compile, and print 3, 1, and 2 at runtime.
(e) The program will compile, and print 1, 3, and 2 at runtime.
public class Initialization { private static String msg (String msg) { System.out.println (msg); return msg; } } public Initialization () { m = msg ("1"); } { m = msg ("2"); } String m = msg ("3"); public static void main(String[] args) { Object obj = new Initialization (); }
Step by Step Solution
3.48 Rating (168 Votes )
There are 3 Steps involved in it
c The program will compile and print 2 3 and 1 at runtime When the object is crea... View full answer
Get step-by-step solutions from verified subject matter experts
