m = input.length();
char[]sort = new.char [m];
input = JOptionPane.showInputDialog("Please Selecet [A/D]:");
for (s = 0; 3<m; s++)
{
if(sort[a] = input.charAt(a));
}
if (input.charAt(0) == 'A' || input.charAt(0) == 'a');
{
Run Code Online (Sandbox Code Playgroud)
我一直在收到错误:
>char[]sort = new.char [m];
Run Code Online (Sandbox Code Playgroud)
...说"行标识符预期".
你能不能请求帮助,我似乎无法让它运行起来.
更改
char[]sort = new.char [m];
Run Code Online (Sandbox Code Playgroud)
至
char[]sort = new char [m];
Run Code Online (Sandbox Code Playgroud)
new是关键字,而不是对象/类.每次使用new(作为关键字)时,都会创建一个新对象或数组.
更新
既然您完全改变了问题,这里就是您的新问题的答案(尽管我认为您应该回滚到原来的问题并问另一个问题):
你没有初始化input,所以它没有价值.这就是为什么你无法比较使用它input.equals(password).
您必须从用户检索输入或至少将输入初始化为:
String input = "";
Run Code Online (Sandbox Code Playgroud)
你可能想要这个:
//...code
JOptionPane.showInputDialog("Please Enter the Password:");
input = IN.readLine();
if(input.equals(password)){
//...code
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
58 次 |
| 最近记录: |