possible loss of precision error

possible loss of precision error

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" );
}

}

View Answers

April 4, 2011 at 11:27 AM

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" );
}
}









Related Tutorials/Questions & Answers:
possible loss of precision error
possible loss of precision error  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
possible loss of precision
is" +intrest); } i have possible loss of precision as my error...possible loss of precision  { int amount=(int)depositAmount; switch (depositAmount) { case(depositAmount<=depAmount1
Advertisements
Precision
Precision  HII, What is precision?   hello,ADS_TO_REPLACE_1 Precision refers the accuracy of the decimal portion of a value. Precision is the number of digits allowed after the decimal point
it possible or not
it possible or not  without public static void main(string args[]) in java program it is possible
Itried all possible ways still getting thesame error
Itried all possible ways still getting thesame error  java.sql.SQLException: Io exception: Got minus one from a read call at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112
Weight loss
Weight loss   Is anybody able to help me. I am wanting to build... and output weight loss given time spent on activities import java.util.*; public... //calculate calories burnt //calculate weight loss //output
ModuleNotFoundError: No module named 'precision-predictiva'
: No module named 'precision-predictiva' error? Thanks   Hi..., ModuleNotFoundError: No module named 'precision-predictiva' error...ModuleNotFoundError: No module named 'precision-predictiva'  Hi
ModuleNotFoundError: No module named 'loss-landscapes'
'loss-landscapes' error? Thanks   Hi, In your python... named 'loss-landscapes' error will be solved. Thanks...ModuleNotFoundError: No module named 'loss-landscapes'  Hi, My
ModuleNotFoundError: No module named 'warp-loss'
-loss' error? Thanks   Hi, In your python environment you... python library, ModuleNotFoundError: No module named 'warp-loss' error...ModuleNotFoundError: No module named 'warp-loss'  Hi, My Python
ModuleNotFoundError: No module named 'focal-loss'
;focal-loss' error? Thanks   Hi, In your python environment you...ModuleNotFoundError: No module named 'focal-loss'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'hmc_loss'
library, ModuleNotFoundError: No module named 'hmc_loss' error...ModuleNotFoundError: No module named 'hmc_loss'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'hmc
ModuleNotFoundError: No module named 'jax-loss'
library, ModuleNotFoundError: No module named 'jax-loss' error...ModuleNotFoundError: No module named 'jax-loss'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'jax
ModuleNotFoundError: No module named 'openerp-decimal-precision'
the ModuleNotFoundError: No module named 'openerp-decimal-precision' error? Thanks  ...-decimal-precision' error will be solved. Thanks...ModuleNotFoundError: No module named 'openerp-decimal-precision'  Hi
tensorflow mixed precision
tensorflow mixed precision  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: tensorflow mixed precision Try to provide me good examples or tutorials links so that I can
ModuleNotFoundError: No module named 'online-triplet-loss'
: No module named 'online-triplet-loss' error? Thanks   Hi..., ModuleNotFoundError: No module named 'online-triplet-loss' error...ModuleNotFoundError: No module named 'online-triplet-loss'  Hi, My
losing precision converting from java BigDecimal to double
losing precision converting from java BigDecimal to double  losing precision converting from java BigDecimal to double
Is it possible in SWT ?
Is it possible in SWT ?  I want drop down like google search (ie, when we type one letter then the word start with that are displayed). when the drop down list appear, then we can select one of word as our text box value. Can i
ModuleNotFoundError: No module named 'possible'
library, ModuleNotFoundError: No module named 'possible' error...ModuleNotFoundError: No module named 'possible'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
Weight Loss
Weight Loss Here we are providing complete information on Obesity and weight loss. This information will guide you in finding the right way in weight loss... disorders as well. We are also discussing about Weight Loss surgery. There are many
Java Error - Java Beginners
demo1.java demo1.java:15: possible loss of precision found : int required: char ch= reader.read(); ^ 1 error import java.io....); //System.out.println("Enter characters, 'q' to quit."); try
can a volatile memory loss data on power cut
can a volatile memory loss data on power cut  Can a volatile memory loss ache and main memory content on power cut?   In Volatile, Cache and main memory will lose their contents when the power is off
Weight Loss Surgery Side Effects
Weight Loss Surgery Side Effects Though Weight loss surgery also known... and body. But they want to look good. Both of these things are not possible... weight includes Bariatric surgery or Weight loss surgery. The size of stomach
Java bigdecimal precision example
Java bigdecimal precision example       In this example, bigdecimal class precision method... the method : public int precision() BigDecimal objects with names x
Weight loss by Ayurveda
Weight loss by Ayurveda There are many ways to loose weight but there has been... weight. Ayurveda weight loss method includes a balanced diet, Yoga and meditation. There are no medicines involved and there are no side effects to weight loss
error
error  while iam compiling iam getting expected error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
error
error  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1 This type error also comes
error
error
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern = /^\d{3,5
error
"+it); } } this is my program i am getting an error saying cannot find symbol class stringADS
error
error  whats the error.............. import java.util.Scanner; public class g { public static void main(String[] args) { Scanner s=new Scanner(System.in); int d,x,y; System.out.println("Enter the first number
JSP-parameters possible ways
JSP-parameters possible ways  In a JSP program called books.jsp, the Java code out.print(request.getParameter(â??numberâ??)); displays â??1111111â??. What are the ways for the parameter number to have got its value
JSP-parameters possible ways
JSP-parameters possible ways  In a JSP program called books.jsp, the Java code out.print(request.getParameter(â??numberâ??)); displays â??1111111â??. What are the ways for the parameter number to have got its value
Is it possible to upgrade mysql 5.1 to 5.5
Is it possible to upgrade mysql 5.1 to 5.5  Is it possible to upgrade mysql 5.1 to 5.5
ModuleNotFoundError: No module named 'possible-english-words'
: No module named 'possible-english-words' error? Thanks   Hi...ModuleNotFoundError: No module named 'possible-english-words'  Hi, My Python program is throwing following error: ModuleNotFoundError
ModuleNotFoundError: No module named 'possible-words-siramkalyan'
the ModuleNotFoundError: No module named 'possible-words-siramkalyan' error? Thanks...;possible-words-siramkalyan' error will be solved. Thanks...ModuleNotFoundError: No module named 'possible-words-siramkalyan'  Hi
Hi Friend..IS IT POSSIBLE? - Java Beginners
Hi Friend..IS IT POSSIBLE?  Hi Friend...Thank u for ur valuable response.. IS IT POSSIBLE FOR US? I need to display the total Number od days... 2008 MONTH 8 DAYS: 8 TOTAL NUMBER OF DAYS : _____ IS IT POSSIBLE FOR US
Is it possible to learn basic Java in a month?
Is it possible to learn basic Java in a month?  Hi, I am big fan of programming language and during my college I did some programming in c/c++. Now.... Is it possible to learn basic Java in a month? Thanks
Is it possible to learn basic Java in a month?
Is it possible to learn basic Java in a month?  Hi, I am big fan of programming language and during my college I did some programming in c/c++. Now.... Is it possible to learn basic Java in a month? Thanks

Ads