请各位大神帮我看一下
package zuoshiyan;
public class HelloWorld1 {
int sum1;
int sum2;
static int sum3;
public void a() {
sum1=12;
System.out.println("diyici");
}
{
sum2=13;
}
{
sum3=14;
}
public static void main(String[] args) {
HelloWorld1 hello=new HelloWorld1();
System.out.println(hello.sum1);
System.out.println(hello.sum2);
System.out.println(sum3);
HelloWorld1 hello2=new HelloWorld1();
HelloWorld1 hello3=new HelloWorld1();
}
}
/*此操作运行结果为:
* 0
* 13
* 14
*请问,为什么不对sum1赋值
*难道就必须要用构造方法才行么
*/