java - 为什么“class new {”会给出编译错误“identifier is expected”?
问题描述
import java.util.*;
import java.io.*;
class new
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(Sytem.in);
System.out.println("enter a number...");
int a = scanner.nextInt();
System.out.println("the number is " + a);
}
}
它在第 3 行抛出一个标识符错误。声明第 3 行需要一个标识符
new.java:3: error: <identifier> expected
解决方案
该词new
属于Java 语言关键字,因此不能用作标识符。
推荐阅读
- python - ValueError:检查目标时出错:预期dense_8的形状为(1,),但数组的形状为(10,)
- c++ - C++按值赋值,有什么缺点?
- c++ - -O1 改变浮点数学
- python-3.x - 下帧不在 tkinter 中渲染
- r - 如何在 R 中使用示例函数进行引导?换行问题
- python - 如何从 Spark SQL Query [PySpark] 中获取表名?
- fortran - 将时间序列数据存储在具有可扩展时间维度的 HDF5 中
- java - 如何在不创建新行的情况下将值存储到 Ms Access 中的单个单元格中?
- php - 一个系列中最大的 5 位数字
- excel - Excel 2013:如何在轴标签中显示相应的文本而不是数字?