这个helloworld错在那里了? (10分)

  • 主题发起人 主题发起人 maozhuxi
  • 开始时间 开始时间
M

maozhuxi

Unregistered / Unconfirmed
GUEST, unregistred user!
小弟刚开始学java,在写helloword的时候遇到一个错误,请指教:
class zz
{
int qq;
}
public class qq
{
zz bian=new zz();
bian.qq=123;
int xx=bian.zz;
public static void main(String arg[])
{
System.out.println("helloworld");
System.out.println(xx);

}
}
抱错为:
--------------------Configuration: j2sdk1.4.2_04 <Default>--------------------
D:/Program Files/Xinox Software/JCreator LE/MyProjects/ZQ/qq.java:9: <identifier> expected
bian.qq=123;
^
1 error
 
不是啊
我才把qq改为v1,还是一样的错误。
 
int xx=bian.zz;???这是什么啊,是这是这里错了?
 
确实是我把这个打错了
int xx=bian.zz
但是改为
int xx=bian.qq
还是一样的错误
 
兄弟,你的文件名是不是qq?
 
class zz
{
int qq;
}
public class qq
{
zz bian=new zz();
//a class include field member,method member and initialization block or
// inner class.
//"bian.qq=123;" is a statement,it should appear in a method or an
//initialization block(like below).
{bian.qq=123;}
int xx=bian.qq;
public static void main(String arg[])
{
//must create a instance of this class.
qq o = new qq();
System.out.println("helloworld");
System.out.println(o.xx);

}
}
I'm learning english and java,please correct my language error when correcting my program error.
 
haa!,Are you making your dream of going abroad?
 
to 蝙蝠:
thank you !
i'm learning english all the time
and learn java few days ago
could you write you e_mail on ?
happy to make friends with you !
 
多人接受答案了。
 
English is a very useful tool,especially in programming area,wherever you are in.
to maozhuxi:I'm happy too.I hope make a "pen friend" with you,we can exchange english or program quesiton.I introduce you a good book about java --"thinking in java",you cando
wnload it from "http://www.mindview.net/Books/TIJ/".I'm biting it. my Email:mdxxx@tom.com
 
后退
顶部