Results 1 to 9 of 9
  1. #1
    MAJ
    MAJ is offline Member
    Join Date
    Jul 2014
    Posts
    17
    Rep Power
    0

    Default Parameter Mystery problem

    I was given this worksheet to study but this code doesn't work

    import java.util.*;
    public class ParameterMystery
    {
    public static void main(String[] args)
    {
    int x = 9;
    int y = 2;
    int z = 5;

    mystery(z,y,x);
    mystery(y,x,z);
    }
    public static void mystery(int x,int z, int y);
    {
    System.out.println(z+ " and " + (y - x));
    }
    }

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    843
    Rep Power
    6

    Default Re: Parameter Mystery problem

    remove the semicolan in the method signature "public static void mystery(int x,int z, int y)" if you put then it won't consirder your method implementation.

    please read the sun tutorial beforing coding.
    Ramya:cool:

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Parameter Mystery problem

    When you have a problem with code "it doesn't work" is no use whatsoever...explain why "it doesn't work".
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    MAJ
    MAJ is offline Member
    Join Date
    Jul 2014
    Posts
    17
    Rep Power
    0

    Default Re: Parameter Mystery problem

    I didn't know why but Ramya explained why it didn't work.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Parameter Mystery problem

    Quote Originally Posted by MAJ View Post
    I didn't know why but Ramya explained why it didn't work.
    But your compiler would have complained...
    Don't you think the error message it gave might have helped?

    Ramya probably needed to copy and paste that code into an IDE to find out the error that you were already seeing.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

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

    Default Re: Parameter Mystery problem

    You asked this question before: Need help understanding Parameter Mystery and it didn't contain this syntax error; I answered your question in your other thread. Are you trolling?

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    MAJ
    MAJ is offline Member
    Join Date
    Jul 2014
    Posts
    17
    Rep Power
    0

    Default Re: Parameter Mystery problem

    I was practicing how to do that code for Thursday's exam. I didn't realize I had posted the correct way of doing that code on a previous thread.

  8. #8
    MAJ
    MAJ is offline Member
    Join Date
    Jul 2014
    Posts
    17
    Rep Power
    0

    Default Re: Parameter Mystery problem

    Quote Originally Posted by Tolls View Post
    But your compiler would have complained...
    Don't you think the error message it gave might have helped?

    Ramya probably needed to copy and paste that code into an IDE to find out the error that you were already seeing.

    The error message I get from the compiler isn't crystal clear. I'm new to Java. Error messages that point to the letter z that comes with a message like "cannot find symbol' doesn't make sense to me because what I had memorized was just like what I saw on the worksheet.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Parameter Mystery problem

    But you could have posted that message here so we knew exactly what the problem was.

    You should not expect someone else on a forum to do extra legwork that would be prevented by you simply posting what's in front of you.

    You're not alone in doing this, by the way. It's quite a common thing, but annoying nonetheless.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Need help understanding Parameter Mystery
    By MAJ in forum New To Java
    Replies: 3
    Last Post: 07-16-2014, 04:24 PM
  2. Cannot find Symbol error - mystery problem
    By Humphrey Bogart in forum New To Java
    Replies: 1
    Last Post: 10-20-2012, 07:57 PM
  3. Replies: 0
    Last Post: 02-03-2012, 03:49 PM
  4. Replies: 2
    Last Post: 01-07-2012, 12:10 AM
  5. Derby Mystery..!!!!
    By yiantzi in forum JDBC
    Replies: 3
    Last Post: 01-24-2011, 12:59 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
  •