Results 1 to 10 of 10

Thread: Unsolved errors

  1. #1
    Andee is offline Member
    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0

    Default Unsolved errors

    The following lines of code

    System.out.print("Player Two: Enter Guess(1) for First Word");
    String GuessOne = Keyboard.readString();


    Are giving me these errors :
    <Identifier> expected > for line one, build output pointing near the bracket.
    and
    Illegal start of type > pointing behind the bracket

    Please help. Thanks :eek:

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,734
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Andee View Post
    The following lines of code

    System.out.print("Player Two: Enter Guess(1) for First Word");
    String GuessOne = Keyboard.readString();


    Are giving me these errors :
    <Identifier> expected > for line one, build output pointing near the bracket.
    and
    Illegal start of type > pointing behind the bracket

    Please help. Thanks :eek:
    Does that line really occur as line #1 of your code? Isn't that line somewhere in a method and inside a class definition? Java is not Basic.

    kind regards,

    Jos

  3. #3
    Andee is offline Member
    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0

    Default

    hi, It's not the first line in the whole program but on removing it and replacing with other code there are no errors.

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,734
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Andee View Post
    hi, It's not the first line in the whole program but on removing it and replacing with other code there are no errors.
    Show us some more code because I guess the compiler is upset because it saw that code where it doesn't belong (not inside a method).

    kind regards,

    Jos

  5. #5
    Andee is offline Member
    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0

    Default

    System.out.println("Player One: Enter first word");
    String Word1 = Keyboard.readString();

    System.out.println("Swap Players");
    System.out.println("Player Two: Enter first word Guess_1");

    //counting the characters in Word1
    int i = 0;
    while (i < Word1.length( ))
    { i++;
    }
    int x = i;


    //Display dashes
    int u = 0;
    do {
    u++;
    System.out.print("_ ");

    }
    while (u!=x);

    }
    //Player Two enters Guess(1) for Word1


    System.out.print("Player Two: Enter Guess(1) for First Word");
    String WordOneGuessone = Keyboard.readString();


    }

    I appreciate your help.

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,734
    Blog Entries
    7
    Rep Power
    21

    Default

    Show us the lines before the lines that are causing the trouble; we need to see some context, not a bunch of statements.

    kind regards,

    Jos

  7. #7
    Andee is offline Member
    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0

    Default

    That's all the program.
    It's homework for students who have been learning java for some weeks, it's really simple however the error is keeping me from being able to finish it.
    It's done using Jcreator

  8. #8
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,734
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Andee View Post
    That's all the program.
    It's homework for students who have been learning java for some weeks, it's really simple however the error is keeping me from being able to finish it.
    It's done using Jcreator
    So those lines you showed us in your first post were the first lines; that is not valid Java; you need to define a class with at least one method in it; the method body defines those statements. Java is not Basic. Please read a tutorial that covers the basics of Java before you start coding anything.

    kind regards,

    Jos

  9. #9
    Andee is offline Member
    Join Date
    Jan 2010
    Posts
    5
    Rep Power
    0

    Default

    public class LastHangman {

    public static void main(String[] args) {

    that?
    I have no idea what you're talking about, I'm new to java. However the programs always work after fixing minor errors. And I'm sure my teacher would get to that.

  10. #10
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,734
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Andee View Post
    public class LastHangman {

    public static void main(String[] args) {

    that?
    I have no idea what you're talking about, I'm new to java. However the programs always work after fixing minor errors. And I'm sure my teacher would get to that.
    Something like that yes; the program as you showed us could never have worked because there are so many syntax errors in it. You are possibly working on some other code that you haven't showed us so we can't answer any questions about it.

    kind regards,

    Jos

Similar Threads

  1. Errors?
    By Jamison5213 in forum New To Java
    Replies: 4
    Last Post: 12-30-2009, 01:14 AM
  2. [UnSolved] Traversing Trees problem
    By RllyNew2Java in forum New To Java
    Replies: 8
    Last Post: 12-24-2009, 08:59 PM
  3. Errors,errors and errors
    By xpatiencex in forum New To Java
    Replies: 6
    Last Post: 04-25-2009, 05:43 AM
  4. Replies: 3
    Last Post: 03-08-2009, 02:51 AM
  5. help with these errors
    By oceansdepth in forum New To Java
    Replies: 3
    Last Post: 04-16-2008, 05:55 PM

Tags for this Thread

Posting Permissions

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