【发布时间】:2014-11-14 07:48:13
【问题描述】:
我无法运行我的班级项目。我对此无药可救,有人可以帮忙吗?
http://i.stack.imgur.com/0yr8J.png
import java.util.Random;
public class HelloWorld {
public static String[] intensities = { "00", "33", "66", "99", "CC", "FF" };
public static String randomColor() {
Random a = new Random();
return "#" + intensities[a.nextInt(6)] + intensities[a.nextInt(6)]
+ intensities[a.nextInt(6)];
}
public static void main(String[] args) {
int nRows = Integer.parseInt(args[0]);
int nCols = Integer.parseInt(args[1]);
String[] colArray = new String[10];
for (int c = 0; c < 10; c++) {
colArray[c] = randomColor();
}
System.out.println("<table border='1'>\n");
for (int i = 1; i <= nRows; i++) {
System.out.println("<tr>");
for (int j = 1; j <= nCols; j++) {
int result = i * j;
int colorNum = result * 10 / (nRows * nCols +1);
System.out.println("<td bgcolor='" + colArray[colorNum] + "'>"
+ result + "</td>");
}
System.out.println("</tr>\n");
}
System.out.println("</table>");
}
}
我无法运行我的班级项目。我对此无药可救,有人可以帮忙吗?
【问题讨论】:
-
请做一些研究并花时间发布一个问题,而不是一个指向显示文本的图片的链接。
-
你为什么决定发布图片而不是文字?
-
寻求调试帮助的问题(“为什么这段代码不起作用?”)必须包括所需的行为、特定的问题或错误以及在问题本身中重现它所需的最短代码。没有明确问题陈述的问题对其他读者没有用处。请参阅:How to create a Minimal, Complete, and Verifiable example。
-
@Pshemo 至少他没有将powerpoint文件与源代码的图片链接:-)