显示错误为
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Duplicate local variable t1
The method set() is undefined for the type Thread
The method get() is undefined for the type Thread
The method set(String) is undefined for the type Thread
The method get() is undefined for the type Thread
at jdbc.TestThreadLocal.main(TestThreadLocal.java:8)
大致意思是:
重复的局部变量t1
对于Thread类型,未定义方法set()
类型Thread的get()方法未定义
类型Thread的方法set(String)未定义
类型Thread的get()方法未定义
上图如下:
然而这是我对着老师的教学视频打的,一字不落,一编译就是这,我在网上复制一样的代码,就不出错。
如下:我把上面t1.set() 改成一个空格都不落下,还是有问题