i am unable to identify the error in my code

i am unable to identify the error in my code

class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter a character"); char ch=(char)br.read(); System.out.println("the entered character is:"+ch); }

}

View Answers

May 30, 2012 at 12:40 PM

Your code needs to import java.io.* package. Moreover, it also requires try catch block as it may throw exception. Anyways, we have modified your code. Here its is:

import java.io.*;

class Program { 
    public static void main(String[] args) {
        try{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); 
        System.out.println("enter a character");
        char ch=(char)br.read();
        System.out.println("the entered character is:"+ch);
        }
        catch(Exception e){}
        }

}









Related Tutorials/Questions & Answers:
i am unable to identify the error in my code
i am unable to identify the error in my code  class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter
i am unable to identify the error in my code
i am unable to identify the error in my code  class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter
Advertisements
can i know the error in this code... am unable to run this code
can i know the error in this code... am unable to run this code  ...}; int n=arr.lenght; System.out.println("length of array:"+n); for(int i=0;i System.out.println(arr[i]); } }   You have used incorrect symbol in your
this is my javascript code and i am not understanding the mistake in this,please help me?
this is my javascript code and i am not understanding the mistake in this,please help me?  <html> <h2>Form Validation</h2> <script language = "Javascript"> function checkEmail
I GOT ERROR FOR MY PROJECT
I GOT ERROR FOR MY PROJECT  Dear Friend/ RoseIndia Team, Firstly I would to thank u Guys help me so many time.. I got error on my little project when running at server. please correctly my error Guys... ERROR CODE: "LOGIN
how can i simplify my java code
how can i simplify my java code  /* Create a program that prompts... Scanner (System.in); String pass=""; int c = 1; int code=0... c=0;int f=0;int i=0; int counter=0; int starter=0; int cot=1
ERROR with my JAVA code - Java Beginners
ERROR with my JAVA code  The error came up in my main method... it wasnt there until i finished my actionListener coding so I dont know how to fix this....it is really stressing me out!! HELP!!! import java.awt.*; import
Am i convetrting the code right ? - Java Beginners
Am i convetrting the code right ?  C# private void button... (IOException ex) { }// i also tried the code below// try... a led on it. The LED blinks on the C#'s code. I think the code i have written
I am not able to display the selected value of my combobox
I am not able to display the selected value of my combobox   <... units order by unitcode"; $rsrcResult = mysql_query($strQuery); $i=1..._assoc($rsrcResult)) { $strA = $arrayRow[$i]; $strB = $arrayRow
I am trying to create domains for column attributes of my data dictionary?
I am trying to create domains for column attributes of my data dictionary?  Please provide me with the best possible solution. I already have the fields and there data types in a table and then the field values in another table
i am getting an error in adding a menu item to a menu.
i am getting an error in adding a menu item to a menu.   i am not able to execute the menu program. i am getting an error at menu.add(menuitem); it says add method is undefined for type menu. but as far as i know that is only way
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
this is my code but i cant able to run it wt is the problem
this is my code but i cant able to run it wt is the problem  import java.io.*; class createthread { int thread=4,i; class thread1 extends createthread { public void run() { for(i=0;i
this is my code but i cant able to run it wt is the problem
this is my code but i cant able to run it wt is the problem  import java.io.*; class createthread { int thread=4,i; class thread1 extends createthread { public void run() { for(i=0;i
My Base Class is Changing every time in my code. How I can overcome this?
My Base Class is Changing every time in my code. How I can overcome this?  I have had the below question asked in interview, i'm curious to learn the answer. I have a base class, 'GeneratorBaseClass' that is extended
unable to display image using html tag in servlet.(image src is in a variable.....). i am using netbeans IDE. plz..........do help
unable to display image using html tag in servlet.(image src is in a variable.....). i am using netbeans IDE. plz..........do help  import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException
I am new to java applets. When i run this code on applet viewer status is displayed that applet not initialized
I am new to java applets. When i run this code on applet viewer status is displayed that applet not initialized  import java.awt.*; import java.awt.event.*; import java.applet.*; public class Textfields extends Applet implements
I am getting error org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'IS_AUTHENTICATED_ANONYMOUSLY' is defined - Spring
I am getting error org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'IS_AUTHENTICATED_ANONYMOUSLY' is defined  Hello, I am getting error
this is my file upload page, here i am not getting tags input field value to my servlet,please suggest a solution?
this is my file upload page, here i am not getting tags input field value to my servlet,please suggest a solution?  <html> <head> <script type="text/javascript"> var counter =1; function
Can someone review my script for an apparent parsing error? -it isn't quite finished yet, but I want to fix error first
Can someone review my script for an apparent parsing error? -it isn't quite finished yet, but I want to fix error first   import java.util.Scanner... to the left side of the page?   Thank you so much, I really appreciate your
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
i want to find the byte code of a image file ... for my project..plz if anybody... a image file to its byte code format that help me for the pattern matching in my project.. but i cant convert Image file to its byte code format.. if anybody can plz
when sending the mail from java I am getting the below error - JavaMail
when sending the mail from java I am getting the below error   when sending the mail from java I am getting the below error : Exception...}} at java.net.URLClassLoader.findClass(libgcj.so.7rh) Code
I'm getting an illgal start of expression error in my code for the public static boolean portion at the bottom... any ideas?
I'm getting an illgal start of expression error in my code for the public static boolean portion at the bottom... any ideas?  heres my code import...; } else { System.out.println("\nI am thinking
I want to Transfer only 1/3rd of contents from one folder to other but my code is transferring all contents
I want to Transfer only 1/3rd of contents from one folder to other but my code...("No files in directory: " + src); } for (int i = 0; i < entries.length; i++) { File file = entries[i
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my code is supposed to ask for an input file and then (ex: input.txt), read... in the file. Also it should be displayed on the screen. However my code doesn't display
Code error
seconds) Hw can i correct this code????????   Basically, the Exception...Code error  package trail; import...); SyndFeed feed=new SyndFeedInput().build(read); for (Iterator i
ModuleNotFoundError: No module named 'will-i-am'
ModuleNotFoundError: No module named 'will-i-am'  Hi, My Python... python library, ModuleNotFoundError: No module named 'will-i-am' error... 'will-i-am' How to remove the ModuleNotFoundError: No module named 'will-i
How can I to my database to my application
How can I to my database to my application  How can I to my database to my application   Hi, Please see the JDBC discussion thread.ADS_TO_REPLACE_1 Thanks
Error in Code - Development process
Error in Code  Hi; This is my code to get all d records from View_Service table but am getting error. I just copied this from net.I am doing mini project plz send me code to get records. What action should i mention
error in code - JDBC
error in code  hi friends i had one problem when i am running the application of jdbc code it is getting that Exception in thread "main" java.lang.NoSuchMethodError: main plz send me the solution for that error   
I have problem in my Project
I have problem in my Project  Dear Sir, i have problem in my project about Jtable i have EDIT JButton whenevery i was click on edit he is display all data from database but i want to select any row
Problem in my code - Development process
Problem in my code  Plz go thru this code. I want to check login and pwd with database. Backend MsAccess , Table name : Reg , Dsn Name: JJ While executing code am getting 404 error User Name Password
I am getting this exception
I am getting this exception   Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java
how to display output on jsp from while loop of action class....actually i am retreiving the post from posts column from my sql.plz help.thnkss
how to display output on jsp from while loop of action class....actually i am retreiving the post from posts column from my sql.plz help.thnkss  how to display output on jsp from while loop of action class....actually i am
ModuleNotFoundError: No module named 'i-am-malicious'
ModuleNotFoundError: No module named 'i-am-malicious'  Hi, My... 'i-am-malicious' error? Thanks   Hi, In your python... 'i-am-malicious' error will be solved. Thanks
ModuleNotFoundError: No module named 'Sam_I_Am'
ModuleNotFoundError: No module named 'Sam_I_Am'  Hi, My Python... library, ModuleNotFoundError: No module named 'Sam_I_Am' error..._I_Am' How to remove the ModuleNotFoundError: No module named 'Sam_I_Am
ModuleNotFoundError: No module named 'i-am-utils'
ModuleNotFoundError: No module named 'i-am-utils'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'i-am-utils' How to remove the ModuleNotFoundError: No module named 'i-am
ModuleNotFoundError: No module named 'Sam_I_Am'
ModuleNotFoundError: No module named 'Sam_I_Am'  Hi, My Python... library, ModuleNotFoundError: No module named 'Sam_I_Am' error..._I_Am' How to remove the ModuleNotFoundError: No module named 'Sam_I_Am
ModuleNotFoundError: No module named 'i-am-malicious'
ModuleNotFoundError: No module named 'i-am-malicious'  Hi, My... 'i-am-malicious' error? Thanks   Hi, In your python... 'i-am-malicious' error will be solved. Thanks
Solve my code
Solve my code  import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.io.*; public class ChangeDetails extends... is the mistake in this code! This is working only one record doesn't work
:( I am not getting Problem (RMI)
I am not getting Problem (RMI)  When i am excuting RMI EXAMPLE 3,2 I am getting error daying nested exception and Connect Exception  
how to display jsp page containing mysql query in particular division using ajax ?my code is below bt i cundt get it properly
ajax ?my code is below bt i cundt get it properly   index.html <... will display here</div> </body> </html> print("code sample...) { e.printStackTrace(); } %> 3)For the above code, we have created following table
Error in a code. - Java Beginners
Error in a code.  This is the question I posted yesterday: "I'm.... I'm confused about where and what i should put into the overall code. Also I can't... is pressed the program has to calculate the prime factors of the given number. I
How can i modify my account in roseindia
How can i modify my account in roseindia  Presently am not using my gmail id. I have to modify my roseindia account. Please send the answer to following mail id
My Sql Error - Development process
My Sql Error  Hello Sir ,I have Created Table with following Query,then Table Created Succefully,But some errors Occured, can u give me the Code...,Its Very Very Urgent. Thank u very Much for urs Great Support in My
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
Swing error in code
_ON_CLOSE); sc.setVisible(true); } } I am getting...Swing error in code  import java.rmi.*; import java.awt.*; import... Panel(new GridLayout(2,2)); SInterface i; public SClientsr
MY Sql Query Error - Not able to Understand the issue
MY Sql Query Error - Not able to Understand the issue  I am new at MYSQL,I wrote simple query as follow: CREATE Table tblFeedBack ( FeedBackID INT... END I am getting an error as follow: Schema Creation Failed: You have an error
Upload Code error on deploying
Upload Code error on deploying  on deploying the above code as it is said it is giving error that " No getter method for property thefile of bean org.apache.struts.taglib.html.BEAN " Error 500--Internal Server Error
How can I find my DHCP IP address on my computer?
How can I find my DHCP IP address on my computer?  Hi, I am using Ubuntu and I trying to find the IP address assigned to my computer by DHCP server. How to find the IP address? Thanks   Hi, You can try following

Ads