+ 25
In java
If we want to get a variable in the form of Float and lnteger and use BufferedReader functions What are the methods used?
5 odpowiedzi
+ 16
No, I don't want an example. What methods are used?
What methods are used for floats and integers in bufferereaders? Only methods?
+ 5
Do you mean, something like that?...
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int i = Integer.parseInt(reader.readLine());
float f = Float.parseFloat(reader.readLine());
+ 5
There are no methods to read integers directly. You have to convert the input..
+ 4
API:
public class BufferedReader
extends Reader
Reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.
Why do you think it can reads floats ?
+ 3
sasan zare
You can look here: https://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html
BufferedReader has no methods for int or float. So you have to do it like in Neuromonkeys example.