Results 1 to 2 of 2
  1. #1
    Zemunsta is offline Member
    Join Date
    Jan 2016
    Rep Power

    Question Trouble with "throws"

    Hey there, so I am asiring to learn Java, and I have been reading over an Oracle Beginners Guide Book to try to learn it. I have got to Chapter 3, which discusses the topic of "Program Control Statements".

    So I am having issues trying to execute the following:

    Java Code:
    public class Main {
        public static void main(String[] args) {
            throws {
                char ch;
                System.out.print("Press a key followed by ENTER: ");
                ch = (char);
                System.out.println("Your key is: " + ch);
    The following Errors I get is as follows:
    Information:Using javac 1.8.0_65 to compile java sources
    Information:java: Errors occurred while compiling module 'KbIn'
    Information:11/01/2016, 3:00 PM - Compilation completed with 3 errors and 0 warnings in 3s 675ms
    Error:(6, 9) java: illegal start of expression
    Error:(6, 23) java: not a statement
    Error:(6, 35) java: ';' expected

    And I am using IntelliJ IDEA 15 CE.

    And here is also a picture of the page demonstrating this code:

    I hope this is enough info to get an verdict on my issue, I appriciate all responses C:

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Trouble with "throws"

    The left curly bracket at the end of line #5 should go (a 'throws' clause should be outside of the body of a method).

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. "Error cannot find symbol" "throws BadLocationException"
    By Daniel Silvester in forum New To Java
    Replies: 8
    Last Post: 07-02-2013, 02:53 AM
  2. Replies: 9
    Last Post: 01-30-2013, 07:17 PM
  3. Replies: 0
    Last Post: 12-07-2012, 09:29 AM
  4. Replies: 2
    Last Post: 02-22-2012, 08:22 PM
  5. Replies: 6
    Last Post: 08-10-2010, 10:22 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