Question: Question 3 1 pts What will be printed in the console when this code is run? public class Q3{ public static void main(String[] args) {
Question 3 1 pts What will be printed in the console when this code is run? public class Q3{ public static void main(String[] args) { int i=0; String s = "Hello"; print3times(s); } public static void print3times (String s){ while(++i<3) { System.out.print(s); } } O Error Hello Hello Hello Hello O Hello Hello 2 Question 4 2 pts We are trying to print "Option 1" to the terminal, but there is a bug in the code below. Choose the answer that best explains the issue. public class (4{ public static void main(String[] args) { int i=0; string s = "Hello"; mi(s, i); } public static void mi(String s, double d){ System.out.println("Option 1"); } public static void m1(String s, int i) { System.out.println("Option 2"); } public static void m1(int i, double d) { System.out.println("Option 3"); } 31 Option 2 is more specific so it is called Ambiguous Invocation Error since option 1 and option 2 could be called Error, there are multiple methods with the same name Option 1 comes before Option 2 so it is call
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
