Java BufferedReader [英] Java BufferedReader
问题描述
我正在YouTube上查看有关BufferedReader的教程
I'm looking at this tutorial about BufferedReader at youtube
https://www.youtube.com/watch?v=yofFVbARIRU
我写的代码与他完全一样,但是我无法正常工作。即使使用
I write the code exactly as he does but I can't get it to work. I cant get the BufferedReader code to work even though I imported it with
import java.io.*;
InputStreamReader stream = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader (stream);
我用以下代码解决了这个问题:
I solved it with this code:
InputStreamReader stream = new InputStreamReader(System.in);
java.io.BufferedReader reader = new java.io.BufferedReader (stream);
这也有效:
java.io.BufferedReader reader =
new java.io.BufferedReader (new InputStreamReader(System.in));
有人可以告诉我第一个代码有什么问题吗?因为它对给教程的人有用
Could someone explain to me what's wrong in the first code? Because it works for him who's giving the tutorial
推荐答案
您可能已经拥有了自己的课程名为BufferedReader,名称与核心类冲突,从而使Java编译器感到困惑。重命名!
You've likely got your own class that you've named BufferedReader and whose name is clashing with the core class and thus confusing the Java compiler. Rename it!
这篇关于Java BufferedReader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!