20170221问题解析请点击今日问题下方的“【Java每日一题】20170222”查看(问题解析在公众号首发,公众号ID:weknow619)
package Feb2017; import java.util.Arrays; public class Ques0222 { public static void main(String[] args) { Dog[] dogs01 = new Dog[2]; dogs01[0] = new Dog("01", "黑色"); dogs01[1] = new Dog("02", "白色"); Dog[] dogs02 = Arrays.copyOf(dogs01, dogs01.length); // 修改dogs02中第二只狗颜色 dogs02[1].setColor("棕色"); // 打印dogs01中狗的颜色 for (int i = 0; i < dogs01.length; i++) { System.out.println(dogs01[i]); } } } class Dog { private String id; private String color; public Dog(String id, String color) { super(); this.id = id; this.color = color; } /* 省略getset方法 */ @Override public String toString(){ return "编号:"+id+", 颜色:"+color; } }
今日问题:
请问主程序输出结果是什么?(点击以下“【Java每日一题】20170222”查看20170221问题解析)
题目原发布于公众号、简书:【Java每日一题】20170222,【Java每日一题】20170222 (也可以扫描头像二维码查看)