java学习中遇见问题
misty19
这个作者很懒,什么都没留下…
展开
-
[报错]idea无法在测试方法中读取键盘输入
在测试中写了如下方法:@Test public void test2() throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); while (true) { System.out.println("请输入字符串:");原创 2022-03-06 18:56:08 · 289 阅读 · 0 评论 -
[报错]Non-static method ‘XX‘ cannot be referenced from a static context
错误代码public class test1 { public static void main(String[] arguments) { int a=12; int b=plus(a); System.out.print(b); } int plus(int a){ int c=10; return a+c; }}报错解决方法1.在使用的方法前加上sta.原创 2021-11-03 10:52:01 · 662 阅读 · 0 评论