在eclipse中写Java时,点击运行却没有反应是怎么回事,难道是代码写错了?

如题所述

不是没运行,是一直在运行,你点击运行,直接把控制台点出来就好了,你没运行估计是控制台在隐藏,死循环没结果,所以没显示·而已;感觉你的太繁琐,我简化了一下:代码:import java.util.*;public class dds { public static void main(String[] args) { int i = (int) (Math.random() * 100 + 1); Scanner in = new Scanner(System.in); boolean ji = true; while (ji) { System.out.println("请输入"); int a = in.nextInt(); if (a > i) { System.out.println("猜大了!"); } else if (i > a) { System.out.println("猜小了!"); } else { System.out.println("猜对了!"); ji = false; } } }}
温馨提示:内容为网友见解,仅供参考
第1个回答  2014-12-18
确定有main函数?截图