Task: create a class Team holding int[] scores. Use defensive copy in constructor.
An integer n
Then n integers (scores)
Stored scores inside Team object
• n ≥ 0
• Must use defensive copy in constructor
If we directly assign the array reference,
outside changes will affect internal data.
Defensive copy means:
Create a new array and copy elements inside constructor.
1.Create class Team.
2.Declare private int[] scores;
3.In constructor:
• Create new array of same length.
• Copy elements manually.
4.Provide getter that also returns copy (optional but safer).