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 8 of 8

Thread: So Lost with void method

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default So Lost with void method

    I get the error cannot find symbol - method method (int)
    public class huh
    {
    public static void method1()
    {
    System.out.println("I wonder who wrote the book on love");
    }
    public static void method1(int x)
    {
    for (i = 0; i < x; i++)
    System.out.println("I wonder who wrote the book on love") + i;
    }
    public static void main(String[] args)
    {
    int i; for (i = 0; i < 6; i++)
    {
    System.out.println(int i);
    method1();
    method(i);
    }
    }
    }
    Last edited by JavaPF; October 27th, 2011 at 02:31 PM. Reason: Added highlight tags..


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,339
    My Mood
    Hungover
    Thanks
    143
    Thanked 625 Times in 536 Posts

    Default Re: So Lost with void method

    What's your questions? Please see the link in my signature on asking questions the smart way. Also, please don't forget the highlight tags when you post code.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: So Lost with void method

    In "method1", you define 'x' as a variable, but not 'i'. Both will need to be defined.

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,339
    My Mood
    Hungover
    Thanks
    143
    Thanked 625 Times in 536 Posts

    Default Re: So Lost with void method

    Quote Originally Posted by tleblanc View Post
    In "method1", you define 'x' as a variable, but not 'i'. Both will need to be defined.
    There are more syntax errors than that. But we are not the OP's compiler. Let him work through the problem and ask specific questions about what's going on.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: So Lost with void method

    BlueJ only shows me one error at a time, and I am only asking for a hint on my current error, not to fix the entire script for me.

    tle - the for statement already defined i did it not?

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,339
    My Mood
    Hungover
    Thanks
    143
    Thanked 625 Times in 536 Posts

    Default Re: So Lost with void method

    Quote Originally Posted by tripline View Post
    BlueJ only shows me one error at a time, and I am only asking for a hint on my current error, not to fix the entire script for me.
    Copy and paste the full error message here.

    But I'll give you a hint- what method do you think method(i) will call? Look at it carefully.

    Quote Originally Posted by tripline View Post
    tle - the for statement already defined i did it not?
    No, but you have plenty of other syntax errors to worry about. Take them one at a time.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: So Lost with void method

    I have no reason to keep anything from the thread.
    Blue J error = cannot find symbol - method method (int)
    That will be the complete and only error that generate until i fix it.

  8. #8
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,339
    My Mood
    Hungover
    Thanks
    143
    Thanked 625 Times in 536 Posts

    Default Re: So Lost with void method

    Quote Originally Posted by tripline View Post
    I have no reason to keep anything from the thread.
    Blue J error = cannot find symbol - method method (int)
    That will be the complete and only error that generate until i fix it.
    Right. And what method do you expect method(i) to call? Look closely at your other methods compared to what you're trying to call. Hint- where is the method named method that takes an integer parameter?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 2
    Last Post: August 3rd, 2011, 11:13 AM
  2. +calculateCharge():Void
    By theoneyouenvy in forum Object Oriented Programming
    Replies: 7
    Last Post: April 20th, 2011, 08:56 PM
  3. javascript:void(0
    By serenafare1 in forum Member Introductions
    Replies: 1
    Last Post: April 12th, 2011, 08:44 PM
  4. Reverse character using void method
    By bgwilf in forum Algorithms & Recursion
    Replies: 2
    Last Post: December 8th, 2010, 06:25 AM
  5. Calling a void method into a static void main within same class
    By sketch_flygirl in forum Object Oriented Programming
    Replies: 3
    Last Post: November 15th, 2009, 04:24 PM