gpt4 book ai didi

java - 需要有关编译器错误的帮助

转载 作者:行者123 更新时间:2023-12-02 11:09:27 25 4
gpt4 key购买 nike

import java.util.Scanner;

public class EnemyMessage {

public static void main(String[] args) {
System.out.println("enter the code:");
Scanner keyboard = new Scanner(System.in);
int key;
int i;
String code = keyboard.next();
for (key = 1; key <= 100; key++) {
for (i = 0; i < code.length(); i--) {
char c = code.charAt(i);
int n = (int) c;
System.out.println(n);
{
(char) c = (int) c - 32 + key + 127;
System.out.println(c);
}
}

}
}
}

这段代码给了我两个对我来说没有多大意义的错误。据我所知,我没有做任何与我之前所做的不同的事情。

错误:
  • 错误的构造函数
  • {"预期
  • 最佳答案

    import java.util.Scanner;
    public class EnemyMessage
    {

    public static void main (String[] args)
    {
    System.out.println("enter the code:");
    Scanner keyboard = new Scanner (System.in);
    int key;
    int i;
    String code = keyboard.next();
    for (key = 1; key<=100; key++)
    {
    for ( i = 0; i < code.length(); i--)
    {
    char c = code.charAt(i);
    int n = (int)c;
    System.out.println(n);
    {
    c = (char)(c - 32 + key + 127);
    System.out.println(c);
    }
    }

    }
    }
    }

    2)"{"预期意味着您缺少 {

    1)错位的构造函数是因为你没有{

    关于java - 需要有关编译器错误的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21805331/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com