
how do i fix this error " possible loss of precision found int required char ch = input.read()"
this is the code
import java.io.InputStreamReader; import java.io.IOException;
class Test1 {
public static void main(String[] args)
{
InputStreamReader input = new InputStreamReader(System.in);
char ch;
System.out.println("Input y to continue");
do
{
ch = input.read();
}
while (ch !='y');
System.out.println("thank you for pressing Y" );
}
}

import java.io.InputStreamReader;
import java.io.IOException;
class Test1{
public static void main(String[] args) throws Exception{
InputStreamReader input = new InputStreamReader(System.in);
char ch;
System.out.println("Input y to continue");
do{
int i=input.read();
ch = (char)i;
}
while (ch !='y');
System.out.println("thank you for pressing Y" );
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.