-1
找不到符號
我試圖找到一個解決方案,以我的時候在Eclipse運行,但它的工作原理編譯錯誤沒有,如果我嘗試編譯它在終端..錯誤:在Java中
這裏有兩個班我已經開始寫
load.java
package doom;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
public class load {
public int row;
public int columns;
private char[][] world;
public load() throws IOException{
BufferedReader file01 = new BufferedReader(new FileReader("map1.txt"));
int rows = 0;
while((file01.readLine()) != null){
rows++;
}
world = new char[rows][];
}
public void getMap() throws IOException{
BufferedReader file01 = new BufferedReader(new FileReader("map1.txt"));
String line;
int i = 0;
while((line=file01.readLine()) != null){
world[i++] = line.toCharArray();
}
System.out.println(Arrays.deepToString(world));
System.out.println(world[4][6]);
file01.close();
}
}
start.java
package doom;
import java.io.IOException;
public class start {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
load world = new load();
world.getMap();
}
}
這裏的電子我嘗試在終端中編譯時遇到了錯誤。
138-38-157-112:tet ciaranashton$ javac start.java
start.java:9: error: cannot find symbol
load world = new load();
^
symbol: class load
location: class start
start.java:9: error: cannot find symbol
load world = new load();
^
symbol: class load
location: class start
2 errors
先編譯load.java。你很好走。 – Batty
只是一個註釋,類名應該以大寫字母開頭。 – turbo
它不好的名稱類小寫。你必須使用MyClass而不是myClass。 – Smertokogt