gpt4 book ai didi

java - System.out.print (""); token "."上的语法错误,@ 应在此 token 之后

转载 作者:行者123 更新时间:2023-11-29 07:00:45 24 4
gpt4 key购买 nike

我在这段代码上遇到了这个错误,我无法弄清楚哪里出了问题。

public class enc {
//The Look-Up Table with the position of all the available characters
public static final String LUT="*, .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
Scanner sc=new Scanner(System.in);
System.out.print("Input the sentence you want to encode.");
String s= sc.nextLine();
}

最佳答案

您需要将代码放在一个方法中:

public class enc {
//The Look-Up Table with the position of all the available characters
public static final String LUT="*, .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.print("Input the sentence you want to encode.");
String s= sc.nextLine();
}
}

关于java - System.out.print (""); token "."上的语法错误,@ 应在此 token 之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26563939/

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