[JAVA] I have a question about keyboard input of numbers

When the character input part of the following code is set to BufferedReader, it cannot be input normally. Why? Works fine with Scanner


		BufferedReader br = new 
                BufferedReader(newInputStreamReader(System.in));

		double max = Double.NEGATIVE_INFINITY;
		double min = Double.POSITIVE_INFINITY;
		double dat = 0;

		System.out.println(max + " " + min);

		for(int i = 0;i < 4;i++) {

			System.out.println("Numerical input");

			dat = br.read(); //here

			if(dat > max) {
				max = dat;
			}
			if(dat < min) {
				min = dat;
			}

		}
		System.out.println("Maximum value:" + max + " " + "minimum value:" +min);

	}

Execution result when using BufferedReader ↓

-Infinity Infinity Numerical input 1 Numerical input Numerical input Numerical input 2 Maximum value: 50.0 Minimum value: 10.0

Recommended Posts

I have a question about keyboard input of numbers
I have a question about Android studio.
I learned about the existence of a gemspec file
I have a question because the gradle setup doesn't work
I want to limit the input by narrowing the range of numbers
[Personal memo] I learned a little about modifiers
Summary of what I learned about Spring Boot
I understood the very basics of character input
[Swift] [Beginner] I searched a lot about #selector
A collection of RSpecs that I used frequently
[Out of 100 points] I thought about a coding test for programming school graduates [Ruby]