Results 1 to 11 of 11
  1. #1
    roach_van is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default [SOLVED] Can't figure out what's wrong

    I am new to Java and I am doing a simple test program to display my first and last name. I need three methods: Main(), Name(), and Display(). I get this error when I compile:

    ShowName.java:16: cannot find symbol
    symbol : method Name()
    location: class ShowName
    Name();

    This is my code:

    public class ShowName
    {
    public static void main(String[] args)
    {
    //data definition
    String firstName;
    String lastName;
    }

    //methods
    {
    Name();
    {
    firstName = "Vanessa";
    lastName = "Roach";

    Display();
    {
    System.out.println("My name is" + firstName + lastName + "!");

    System.exit(0);
    }
    }
    }

    I would really appreciate any help I can get on this

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    You have a ; following the method name that makes it look like a call to that method rather than a definition of it.
    Also is there an extra { before Name()?


    It's hard to read your code without formatting.
    Please use the [ CODE ] tags around your code to preserve formatting.

  3. #3
    roach_van is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default

    Thank you for the reply

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    If you have solve the problem please mark the thread as solved. It's help to avoid confusion on other members.

  5. #5
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    Can't you do that? As a moderator?
    I die a little on the inside...
    Every time I get shot.

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Maybe (s)he could, but it still wouldn't be his/her job to tell the OP that (s)he must be satisfied with some answer already given. It is up to the OP to decide when the problem is solved.

  7. #7
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    She looks like a woman to me, if it's her on the pic there. ;)
    I die a little on the inside...
    Every time I get shot.

  8. #8
    roach_van is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default

    I will try to remember that Eranga. Was first time in forum and didn't realize.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Supamagier View Post
    Can't you do that? As a moderator?
    Yes, I can do that. But it's more important way is done by thread starter. Because he/she is the person who knows that weather the given answers by other members are satisfied his/her issue.

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by masijade View Post
    Maybe (s)he could, but it still wouldn't be his/her job to tell the OP that (s)he must be satisfied with some answer already given. It is up to the OP to decide when the problem is solved.
    Exactly. It should be.

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by roach_van View Post
    I will try to remember that Eranga. Was first time in forum and didn't realize.
    Cool. :) Forums are really helpful to learn new things in short period of time. These kind of rules can be really helpful to you, when you need a help from others. So the best thing is, in your free time just read our FAQ page.

Similar Threads

  1. [SOLVED] Can't figure out my thread/awt problem
    By Zosden in forum Advanced Java
    Replies: 7
    Last Post: 07-29-2008, 05:13 PM
  2. Replies: 2
    Last Post: 07-11-2008, 09:41 AM
  3. Replies: 3
    Last Post: 12-25-2007, 04:10 AM
  4. Seems so simple yet I can't figure it out!
    By adamhaviland in forum New To Java
    Replies: 1
    Last Post: 11-03-2007, 06:26 PM
  5. I can't figure this out
    By silvia in forum New To Java
    Replies: 3
    Last Post: 07-20-2007, 04:38 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
  •