Results 1 to 3 of 3
  1. #1
    ferfykins is offline Member
    Join Date
    Feb 2017
    Posts
    24
    Rep Power
    0

    Default What's wrong with my code? :O

    Java Code:
    class ferf {
    	public static void main(String args[]) {
    		char ch;
    		ch = (char) System.in.read();
    		if (ch == 'k') System.out.println("k");
    	}
    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: What's wrong with my code? :O

    Why do you think there is anything wrong with the code?
    If there are error messages, copy the full text and paste it here.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    ferfykins is offline Member
    Join Date
    Feb 2017
    Posts
    24
    Rep Power
    0

    Default Re: What's wrong with my code? :O

    Quote Originally Posted by Norm View Post
    Why do you think there is anything wrong with the code?
    If there are error messages, copy the full text and paste it here.
    ferf.java:4: error: unreported exception IOException; must be caught or declared to be thrown
    ch = (char) System.in.read();
    ^
    1 error


    nvm figured it out, missing:

    throws java.io.IOException {
    Last edited by ferfykins; 02-23-2017 at 10:50 PM. Reason: ya

Similar Threads

  1. what's wrong with this code
    By Tripleg in forum New To Java
    Replies: 4
    Last Post: 06-03-2014, 05:20 AM
  2. What is wrong with my code?
    By tweetychirpy in forum Threads and Synchronization
    Replies: 4
    Last Post: 12-23-2011, 05:16 PM
  3. what is wrong with my code
    By amrmb09 in forum New To Java
    Replies: 7
    Last Post: 02-11-2011, 05:10 PM
  4. Please tell me what i am doing wrong in this code
    By Basit781 in forum CLDC and MIDP
    Replies: 11
    Last Post: 05-20-2010, 05:08 PM
  5. What is wrong with this code
    By rosh72851 in forum New To Java
    Replies: 13
    Last Post: 10-31-2008, 01:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •