Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted

在java中写switch代码时,参数用的是string,jdk用的是1.8,但是还是报错,说不支持1.7版本以下的,然后查找了项目中的一些文件,打开一个文件如下,发现是1.6的版本,好奇怪啊,按照eclipse提示,将版本换成1.7的,就可以了。

时间: 2024-11-05 12:24:47

Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted的相关文章

android switch(String)错误:Cannot switch on a value of type String for source level below 1.7

switch语句的判断条件可以接受int,byte,char,short,不能接受其他类型只有JDK版本1.7以上才可以支持String 设置如下可解决问题:(若没有JDK1.7版,可下载一下安装)菜单选项-->project->properties->java compiler->compiler compliance level:选1.7即可

Cannot find an initializer for type '[(String)]' that accepts an argument list of type '(LazyForward

Swift编译错误: Cannot find an initializer for type '[(String)]' that accepts an argument list of type '(LazyForwardCollection<MapCollectionView<Dictionary<Int, String>, Int>>)' 错误代码: var dict = [1: "m", 2: "i", 3: "i

swift2.0 Cannot assign a value of type &#39;[CFString]&#39; to a value of type &#39;[String]&#39;

Cannot assign a value of type '[CFString]' to a value of type '[String]' 代码示例如下: picker.mediaTypes = [kUTTypeImage] 修改如下: picker.mediaTypes = [kUTTypeImage as String] swift2.0 Cannot assign a value of type '[CFString]' to a value of type '[String]'

报错The &quot;chunk&quot; argument must be one of type string or Buffer. Received type object

报错内容: TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be one of type string or Buffer. Received type object at ServerResponse.end (_http_outgoing.js:690:13) 原因: response.end()方法接收的参数类型只能是字符串或Buffer, 传入的是object 解决: 找到代码出错行,重写end方法,如:r

Ant Design 中Select组件报错 Invalid prop `value` of type `string` supplied to `Select`

Invalid prop `value` of type `string` supplied to `Select`, expected `array` when `multiple` or `tags` is `true`. 这个位置默认值为数组 [ ] 原文地址:https://www.cnblogs.com/dianzan/p/12230353.html

Bitmap(Type, String) 图片路径

Bitmap(Type, String) 从指定的资源初始化 Bitmap 类的新实例. public Bitmap (Type type, string resource); 参数 type Type 用于提取资源的类. resource String 资源的名称. 示例 下面的代码示例演示如何从类型构造位图,以及如何使用 Save 方法. 若要运行此示例,请将代码粘贴到 Windows 窗体中. 处理窗体的 Paint 事件并调用 ConstructFromResourceSaveAsGif

Syntax error, type parameters are only available if source level is 1.5

出处: Syntax error, type parameters are only available if source level is 1.5 当我的eclipse使用jdk1.6的时候,创建泛型类,系统会提示错误: “Set project compiler compliance settings to '1.5'” “Syntax error, type parameters are only available if source level is 1.5” 这时候需要改动两个地方

Switch能否用string做参数?

由于小编自己的编译环境jdk用的是比较高,在命令窗口输入java -version即可看到.(打开命令窗口win+R,输入cmd,回车) java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode) String类型一直可以当做Switch的参数,编译和运行都没有

Java switch 语句使用 String 参数

原文同步至 http://www.waylau.com/java-switch-use-string/ 当我尝试在 switch 语句使用 String 参数时(注意ctrType为字符串) switch (ctrType) { case "01" : exceptionType = "读FC参数数据"; break; case "03" : exceptionType = "读FC保存的当前表计数据"; break; def