java能编译,为什么不能执行啊,我是照书上打的!
t.*;publicclassFiveButtons{publicstaticvoidmain(Stringargs[]){Framef=newFrame("BorderLayout");tLayout(newBorderLayout());d("北",newButton("North"));d("南",newButton("South"));d("东",newButton("East"));d("西",newButton("West"));d("中",newButton("Center"));tSize(100,100);tVisible(true);}}
你的英文与中文的地方放反了.像这样就行了. d("North", new Button("北")); d("South", new Button("南")); d("East", new Button("西")); d("West", new Button("东")); d("Center", new Button("中")); 不要绝对的相信书上的东西.它也有错的时候.
你的书是盗版的所以不要一味迷信书上的东西楼上说的都不错! t.*;publicclassFiveButtons{publicstaticvoidmain(Stringargs[]){Framef=newFrame("BorderLayout");tLayout(newBorderLayout());d("North",newButton("North"));d("South",newButton("South"));d("East",newButton("East"));d("West",newButton("West"));d("Center",newButton("Center"));tSize(100,100);tVisible(true);}}
如果你用ECLIPSE编译,把你工程字符集改成UTF-8就支持中文了在“工程名”上右击,选择“properties”--->"Info"--->"Textfileencoding"--->" "
你的源程序 t。*;public class FiveButtons{ public static void main(String args[]){ Frame f = new Frame("BorderLayout"); tLayout(new BorderLayout()); d("北", new Button("North")); d("南", new Button("South")); d("东", new Button("East")); d("西", new Button("West")); d("中", new Button("Center"));//这里的“北,南,东,西,中”五个汉字应该用英文单词,这里是作为固定参数出现的 tSize(100,100); tVisible(true); } } 修改后的程序 t。
*;public class FiveButtons{ public static void main(String args[]){ Frame f = new Frame("BorderLayout"); tLayout(new BorderLayout()); d("North", new Button("North")); d("South", new Button("South")); d("East", new Button("East")); d("West", new Button("West")); d("Center", new Button("Center")); tSize(100,100); tVisible(true); } }。
答:变量j是一个方法中的局部变量,Java语法规定,局部变量在使用前必须被显式(implicit)初始化,否则,如果该变量没有被使用,则编译和运行都不会报错,如果该...详情>>
答:google "java 缓冲池"详情>>
答:百度里搜张孝祥 非常好的视频教程详情>>