您好我有一个显示某些土地面积的程序.这个数字是1900平方公里.我想写这个1900平方公里,但这两个应该看起来像一个"2的力量"符号.有没有办法可以插入这样的符号?
您好我有一个加载值的应用程序.值为x,y和字符串值.我想知道如何加载一个字符串,因为我只知道如何使用整数.看看这段代码:
public static void loadStars() {
try {
BufferedReader bf = new BufferedReader(new FileReader ("files/cards.txt"));
for (int i = 0; i < 10; i++) {
String line;
while ((line = bf.readLine()) != null) {
String[] args = line.split(" ");
int x = Integer.parseInt(args[0]);
int y = Integer.parseInt(args[1]);
String name = Integer.parseInt(args[2]);
play.s.add(new Star(x,y,name));
}
}
bf.close();
} catch (Exception e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
我有
play.s.add(new star(x,y,name));
Run Code Online (Sandbox Code Playgroud)
我知道如何加载x,y但我不知道如何加载name.请帮我.
编辑 - -
在其中加载的文件格式如下:
x y …Run Code Online (Sandbox Code Playgroud) java ×2