我无法理解以下代码中的控制流程:
class Television {
private int channel=setChannel(7);
public Television (int channel) {
this.channel=channel;
System.out.println(channel + "");
}
public int setChannel(int channel) {
this.channel=channel;
System.out.print(channel + " ");
return channel;
}
}
public class TelevisionMain {
public static void main(String[] args) {
Television t = new Television(12);
}
}
输出为 7 12。
这意味着首先发生显式调用。我是java新手,我认为执行从main开始,所以应该首先调用构造函数。谁能解释一下为什么会这样。