Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 11 of 11

Thread: What's wrong with my code?? (Total beginner)

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default What's wrong with my code?? (Total beginner)

    Hey, I have only been doing java for 2 days now and I am stuck with 6 errors in my code I started with 36 and have managed to solve 30 myself. Please don't be to harsh on me =)

    anyway here are the errors:

    == ERRORS FOUND ==

    warning: [options] bootstrap class path not set in conjunction with -source 1.6
    src\minecraft\net\minecraft\src\EntitySheep.java:1 53: error: illegal start of ex
    pression
    public static int getRandomFleeceColor(Random, random);
    ^

    src\minecraft\net\minecraft\src\EntitySheep.java:1 53: error: illegal start of ex
    pression
    public static int getRandomFleeceColor(Random, random);
    ^

    src\minecraft\net\minecraft\src\EntitySheep.java:1 53: error: ';' expected
    public static int getRandomFleeceColor(Random, random);
    ^

    src\minecraft\net\minecraft\src\EntitySheep.java:1 78: error: illegal start of ex
    pression
    protected EntityAnimal spawnBabyAnimal(EntityAnimal entityanimal);
    ^

    src\minecraft\net\minecraft\src\EntitySheep.java:1 78: error: ';' expected
    protected EntityAnimal spawnBabyAnimal(EntityAnimal entityanimal);
    ^

    src\minecraft\net\minecraft\src\EntitySheep.java:1 78: error: ';' expected
    protected EntityAnimal spawnBabyAnimal(EntityAnimal entityanimal);
    ^

    6 errors

    AND HERE IS MY CODE:
    Last edited by TheProf; January 6th, 2012 at 02:41 PM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: What's wrong with my code?? (Total beginner)

    Please Edit your post and wrap your code with[code=java]<YOUR CODE HERE>[/code] to get highlighting

    Check that your {}s are properly paired. Especially look around the line where the error message points.

    Because of your unformatted code, it is very hard to see the pairings of the {}s.
    Last edited by Norm; January 5th, 2012 at 04:09 PM.

  3. The Following User Says Thank You to Norm For This Useful Post:

    TheProf (January 5th, 2012)

  4. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: What's wrong with my code?? (Total beginner)

    formatted the code thanks for telling me how =)

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: What's wrong with my code?? (Total beginner)

    Did you check the placing of the {}s?

  6. The Following User Says Thank You to Norm For This Useful Post:

    TheProf (January 6th, 2012)

  7. #5
    Junior Member
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: What's wrong with my code?? (Total beginner)

    yes, they seem to be correct although as I said above I am a complete newbie when it comes to java and programming in general

  8. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: What's wrong with my code?? (Total beginner)

    The compiler says there is a problem. Look just before line 153 where the error message is.

  9. #7
    Junior Member
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: What's wrong with my code?? (Total beginner)

    That's the code before line 153 i can't see a problem. can you?
    Last edited by TheProf; January 6th, 2012 at 02:42 PM.

  10. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: What's wrong with my code?? (Total beginner)

    If that's ok keep looking.

    One technique is to comment out large sections of the code.
    Put a /* just after the ending } of a method before line 153
    and put a */ farther on in the code just before a method definition.
    If the error message goes away then the error is between the /* and the */
    If you get the same error, move the /* towards the top one method and move the */ down to the next method and try again.

    You might get other errors about symbols not being defined, which you can ignore, but you need to find where the mismatched {}s are. When you have bracket them, then get your magnifying glass and look closely at the code between the /* and the */

  11. #9
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: What's wrong with my code?? (Total beginner)

    Hi, The Prof.

    I see you are trying to reverse engineer Minecraft. There are four things I think you should be aware of. Firstly, Minecraft is still copywrite. Notch has promised he will release it as open source once he has earned enough money but for the moment what you are doing (sharing decompiled source) is technically illegal. Secondly, the source is Obscurified; that means Notch is deliberately making your life harder. Thirdly, I have studied the source extensively and I can guarantee you that this is a very poor exercise for a new programmer. Notch is a brilliant programmer; one of the best. He utilizes some design patterns and optimization techniques that make professional programmers cry at their own inadequacy. Finally, some clever bugger came up with the Minecraft Coders Pack (MCP). If you need assistance in compiling the coders pack (I assume you want to write your own MOD) I suggest you follow the instructions on the page EXACTLY and then direct your questions/problems to the IRC channel or the Minecraft forums.


    Have fun!

  12. The Following User Says Thank You to ChristopherLowe For This Useful Post:

    TheProf (January 6th, 2012)

  13. #10
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: What's wrong with my code?? (Total beginner)

    Oh, I just noticed an extra opening braket '{' on line 52 before public static int getRandomFleeceColor(Random, random); which is the cause of at least one of those error messages (possibly all of them).

  14. The Following User Says Thank You to ChristopherLowe For This Useful Post:

    TheProf (January 6th, 2012)

  15. #11
    Junior Member
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: What's wrong with my code?? (Total beginner)

    Thanks for your contribution but it did't help so I just deleted the code and rewrote the whole thing now it works =D also I am going to remove the code from this as you have informed of it being illegal to post so thanks anyway.

Similar Threads

  1. (TOTAL BEGINNER)Stupid problem but still...
    By ggmike in forum What's Wrong With My Code?
    Replies: 7
    Last Post: January 5th, 2012, 10:01 PM
  2. (Total Beginner): Any suggestions on how to do that?
    By ggmike in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 5th, 2012, 09:40 PM
  3. Please held. What is wrong with my code? I am a beginner ;)
    By mvonb17 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 30th, 2011, 05:33 PM
  4. Replies: 3
    Last Post: October 19th, 2011, 11:55 PM
  5. Replies: 1
    Last Post: May 3rd, 2011, 09:46 AM

Tags for this Thread