edward9
Power Member
Boas, o output deste codigo não deveria ser [3, 7, 5, 9 ] ?
import java.util.*;
public class MyCoffee implements Coffee {
public static void main(String[] args) {
List<String> x = new ArrayList<String);
x.add("3");
x.add("7");
x.add("5");
List<String> y = new MyCoffee().fazAlgo(x);
y.add("1");
System.out.println(x);
}
public List<String> fazAlgo(List<String>z){
z.add("9");
return z;
}
}
import java.util.*;
interface Coffee {
List<String> fazAlgo(List<String> s);
}
Obrigado pelo vosso tempo!
import java.util.*;
public class MyCoffee implements Coffee {
public static void main(String[] args) {
List<String> x = new ArrayList<String);
x.add("3");
x.add("7");
x.add("5");
List<String> y = new MyCoffee().fazAlgo(x);
y.add("1");
System.out.println(x);
}
public List<String> fazAlgo(List<String>z){
z.add("9");
return z;
}
}
import java.util.*;
interface Coffee {
List<String> fazAlgo(List<String> s);
}
Obrigado pelo vosso tempo!