Cannot resolve method 'unread' in 'BufferedReader'
时间: 2023-10-22 14:10:49 浏览: 41
This error occurs because the `BufferedReader` class does not have a method called `unread()`.
If you want to unread a character from a `BufferedReader`, you can use the `mark()` and `reset()` methods. Here's an example:
```
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int c = reader.read(); // read a character
reader.mark(1); // mark the current position
// do something with the character
reader.reset(); // unread the character
```
Alternatively, you can use a `PushbackReader` which provides a `unread()` method:
```
PushbackReader reader = new PushbackReader(new InputStreamReader(System.in));
int c = reader.read(); // read a character
reader.unread(c); // unread the character
```