Home Answers Viewqa Java-Beginners possible loss of precision error

 
 


derek
possible loss of precision error
1 Answer(s)      2 years and a month ago
Posted in : Java Beginners

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 Pages:
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
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
Precision
Precision  HII, What is precision?   hello, Precision refers the accuracy of the decimal portion of a value. Precision is the number of digits allowed after the decimal point
Java Error - Java Beginners
Java Error  E:\SUSHANT\Core Java\FileHandling\Error>javac demo1.java demo1.java:15: possible loss of precision found : int required: char ch= reader.read(); ^ 1 error import java.io.
it possible or not
it possible or not  without public static void main(string args[]) in java program it is possible
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
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
hi see and give me reply as soon as possible
hi see and give me reply as soon as possible  Hi Friend, I got path,but it will again ask path error first i was gave index.jsp.It.../hello) is not available. JBoss Web/2.1.2.GA above error will displayed pls
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.... We are also discussing about Weight Loss surgery. There are many advantages
Surgery to lose weight
on Possible Complications of weight loss surgery (Bariatric Surgery), Weight Loss... is now opting for the weight loss surgery to reduce the weight. Weight loss surgery is also one of the options for the weight loss. Surgery to lose weight
java program...need help as soon as possible!!! - Java Beginners
java program...need help as soon as possible!!!  Modify the Lexer (15.... Include line number information within tokens for subsequent error reporting, etc...) 5. } If you encounter an error, e.g. you find a "%" on line 7 of the source
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
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
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 This article explains you the importance of Ayurveda in weight loss. Using Ayurvedic principals you can lose your weight easily... following things for weight loss: Obesity Massage Obesity Reduction
Weight Loss Surgery Side Effects
Weight Loss Surgery Side Effects This article we are discussing the side effects of weight loss surgery. What kind of side effects can occur after the surgery? Will a patient gain weight back? If you are thinking that Weigh Loss
programming error
programming error  I got an error when i did the following program... for the respective name" error i got is:SQL exception please give me the solution by providing the exact coding,as soon as possible
Error in JfreeChart
Error in JfreeChart  I am getting an error when i am using jfreechart for graph generation, that is: D:\my\linechart.java:5: package org.jfree.chart does not exist import org.jfree.chart.*; what is the reason and possible
Error in JfreeChart
Error in JfreeChart  I am getting an error when i am using jfreechart for graph generation, that is: D:\my\linechart.java:5: package org.jfree.chart does not exist import org.jfree.chart.*; what is the reason and possible
NumberFormatter in Flex4
rounding and precision, thousand separator and negative sign. for example,203.4567=203.456 . You can use the precision property for decimal length. If an error occurs this error is saved to the error property. The error property has two
Error processing
Java: Error processing Error in user input or action If the user makes an error in input, give the appropriate feedback, and allow them to correct the error if possible. It's very important to give specific feedback that allows them
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
JScript error - JSP-Servlet
project for my class. It has session concept.There are 57 possible logins. In some logins while updating profile it will not show any error. But, in many logins it shows error as unterminated string. I am not able
Difference between error and exception ????????
Difference between error and exception ?  Can we handle a error in java if yes than give an code of an example? Difference between error... yourself or that might be thrown because of an obvious run-time error such as trying
exception error inservlet
exception error inservlet  Hi,i got the error as..below..wat could be the possible mistake ?THANK YOU!!! type Exception report message description The server encountered an internal error () that prevented it from fulfilling
java error - Java Beginners
. But if I want to run that program the fetches me the following error. For example...:\Program Files\Java\jdk1.6.0_17\bin> what may be the possible problem... uninstalled jdk and NetBeans and reinstalled them, Then too its the same error
submition error - WebSevices
system is searching for possible duplicate entries. A duplicate entry will not allow...(); ---------------------------------------------- Error: I store this hidden values
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 use jsp in java script
is it possible to use jsp in java script  is it possible to use jsp inside the javascript while using java script in body tag on that time i am calculate number of records in mysql, so that i am using jsp.if count value
is it possible to use jsp in java script
is it possible to use jsp in java script  is it possible to use jsp inside the javascript while using java script in body tag on that time i am calculate number of records in mysql, so that i am using jsp.if count value
SQL error - JSP-Servlet
. If it is not possible please send me an alternate option to solve this. Help me.  Hi friend its possible... Here is the solution...){ System.out.println("Error occured while updating!!!"); } con.close
script error - Java Beginners
script error  hi, Is it possiple to use PHP function under the script tag. plz help me. thank u in advance. regards, sakthi  Hi Friend, Yes It is possible to use PHP function under the script Tag. Thanks
Snippet Code Error
Snippet Code Error  The following is a snippet of code from a Java application which uses Connector/J to query a MySQL database. Identify possible problems and possible solutions. Connection cn= DriverManager.getConnection
array find all possible dimension
array find all possible dimension  Given array: int[] dimension = { 1, 2, 3 }; That produces the output: 1 2 3 12 13 23 123 I'm new to array...i can't figure out the way on even how to start... any idea?...really appreaciate
Displaying error on the Same form
Displaying error on the Same form  I want to display the errors... to display the error messages. It is working properly. But those error messages.... But the problem is still. Could you please provide me the reason or possible
ERROR - Java Beginners
ERROR  Hello Sir i am getting error to this code 1.write... am getting an error that is StringProgram.java:6: cannot resolve symbol... give me the solution to these errors as quickly as possible.   Hi
error
error  while iam compiling iam getting expected error
applet security error - Security
my jsp page, the following security error occured. ERROR: Java Plug..., i have to import the verisign certificate in all hosts. It's not possible
Programming Error - JSP-Servlet
should get the images folder from which he can select images then how is it possible... displayed in count box in number which must be disabled then how is it possible Eg
Error in a code. - Java Beginners
Error in a code.  This is the question I posted yesterday: "I'm...?" So my other two questions are: 1) is it possible to make exactly the same... should give an appropriate error message. The first part works perfectly fine
Shortest the program as possible but output will not change
Shortest the program as possible but output will not change  #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define MAX_BUF 50 // Size of the buffer to hold intermediate
Shortest the program as possible but output will not change
Shortest the program as possible but output will not change  #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define MAX_BUF 50 // Size of the buffer to hold intermediate
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
jsp error - JSP-Servlet
out of this problem as soon as possible.   Hi friend, I am
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
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
Programming Error - JSP-Servlet
page. and this should be possible only if user clicks on confirm button

Ask Questions?

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.