i am unable to identify the error in my code

Ads
 

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){}
        }

}

Ads









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
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
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
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
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
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
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
:( 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  
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
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 '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 '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 '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
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
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
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
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 am getting multiple values in listbox
i am getting multiple values in listbox   hi sir, i am using... table group by stuname) order by a.name in a subquery multiple recdates i am getting its working fine, but in main query also i am getting multiple name
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
I am beginner and want to learn Java fast
I am beginner and want to learn Java fast  Hi, I am a beginner... to take in every single ideas completely. When you can code in a decent standard... the more proficiently. On the off chance that you can do as such, at that point my
I am beginner and want to learn Java fast
I am beginner and want to learn Java fast  Hi, I am a beginner... to take in every single ideas completely. When you can code in a decent standard... the more proficiently. On the off chance that you can do as such, at that point my

Ads