Question 11
Consider the code given below.
class CricketMatch implements Cloneable { String teamName; int[] scores;
public CricketMatch(String n, int[] s) { teamName = n; scores = s; }
public Object clone() throws CloneNotSupportedException { return super.clone(); }}public class Test { public static void main(String[] args) throws CloneNotSupportedException { int[] s = {250, 300, 275}; CricketMatch m1 = new CricketMatch("India", s); CricketMatch m2 = (CricketMatch) m1.clone(); CricketMatch m3 = m1;
m2.scores[1] = 320; m3.teamName = "Australia";
System.out.println(m1.teamName + " " + m1.scores[1]); System.out.println(m2.teamName + " " + m2.scores[1]); System.out.println(m3.teamName + " " + m3.scores[1]); }}What will the output be?