作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试从 Head First Java 运行代码,如下所示:
public class PhraseOMatic {
public static void main(String[] args){
String[] wordListOne = {"24/7", "mult-iTier", "30,000 foot", "B-to-B", "win-win", "front-end", "web-based", "pervasive", "smart", "six-sigma", "critical-path", "dynamic"};
String[] wordListTwo = {"empowered", "sticky", "value-added", "oriented", "centric", "distributed", "clustered", "branded", "outside-the-box", "positioned", "networked", "focused", "leveraged", "aligned", "targeted", "shared", "cooperative", "accelerated"};
String[] wordListThree = {"process", "tipping-point", "solution", "architecture", "cor competency", "strategy", "mindshare", "portal", "space", "vision", "paradigm", "mission"};
int oneLength = wordListOne.length;
int twoLength = wordListTwo.length;
int threeLength = wordListThree.length;
int rand1 = (int) (Math.random() * oneLength);
int rand2 = (int) (Math.random() * twoLength);
int rand3 = (int) (Math.random() * twoLength);
String phrase = wordListOne[rand1] + " " + wordListTwo[rand2] + " " + wordListThree[rand3];
System.out.println("What we need is a " + phrase);
}
}
我就是在这里收到此错误:
线程“main”java.lang.Error中出现异常: Unresolved 编译问题:
at PhraseOMatic.main(apples.java:2)
我从错误中看到问题出在第 2 行,但我可以识别错误
最佳答案
查看异常跟踪 (PhraseOMatic.main(apples.java:2)
)。您的公共(public)类 PhraseOMatic
必须与 PhraseOMatic.java
文件一起保存。 顶级
公共(public)类和.java文件的名称必须相同。
关于java - 线程 "main"java.lang.Error : Unresolved compilation (PhraseOMatic) 中出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12136345/
我尝试从 Head First Java 运行代码,如下所示: public class PhraseOMatic { public static void main(String[] args
我是一名优秀的程序员,十分优秀!