我只想简单澄清这两行代码。这两者之间的区别是什么?
SuperClass c = new JustTesting(1, 'b');
JustTesting b = new JustTesting(2, 'c');
顺便说一下,如果您想查看完整代码,请点击此处:
import static java.lang.System.out;
public class JustTesting extends SuperClass{
public JustTesting(int firstVar, char secondVar) {
super(firstVar, secondVar);
}
public static void main(String[] args) {
SuperClass c = new JustTesting(1, 'b');
JustTesting b = new JustTesting(2, 'c');
out.println(c.firstVar);
out.println(b.firstVar);
}
}