Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 Not yet answered What will happen when you compile and run the following code? public class Test{ private int i = 0; Marked
Question 1 Not yet answered What will happen when you compile and run the following code? public class Test{ private int i = 0; Marked out of 1.00 P Flag question class TestInner{ public int i = 1; void sayHi() { System.out.println(i); } } public static void main(String[] args) { TestInner inner = new Test().new TestInner(); inner.sayHi(); } } a. 1 O b. Runtime error O c. O O d. Compilation Error Question 2 Not yet answered Marked out of 1.00 What will happen when you compile and run the following code? class One{ public One() { System.out.print("One"); } public One(String str){ System.out.print("OneStr"); } } P Flag question class Two extends One{ public Two (String str){ System.out.print("TwoStr"); super(str); } } public class Test{ public static void main(String[] args) { Two two = new Two ("Hello"); } } O a. OneStr Two Str b. Two StrOne Str Oc. One TwoStrOneStr O d. one of the above
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started