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

Thread: Can't pass to the other method

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can't pass to the other method

    Hi, i am using package, and i want to call a method in the other java file called triangle, but it can't. i tried to pass this

    Triangle tri = new Triangle();
    tri. create();

    but it said "Accessing static method create()", both of the method is static.
    After that, i use the suggestion from NetBeans, which is "Replace with class reference" and then it change to
    Triangle.create();

    but it still can't pass to the method create. can anyone please help?
    Thank you


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: Can't pass to the other method

    Look into what static actually means. What do you mean you "can't pass to the method"? Pass what? Does the method have any parameters?

  3. #3
    Junior Member
    Join Date
    Aug 2010
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can't pass to the other method

    I have delete all related static from the method, and now i got another error, it is
    "Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
    at triangle_projection.Prim.<init>(Prim.java:10)
    at triangle_projection.Triangle.<init>(Triangle.java: 13)
    at triangle_projection.Prim.<init>"
    what is this? i haven't seen this before, can you please help me?
    Thank you
    Last edited by mingming8888; October 27th, 2010 at 10:25 AM.

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: Can't pass to the other method

    That looks like you're stuck in an infinite recursive loop. One method is calling another method, which is calling the first method, which calls the second method, which...

    But if you want any more help, you'll have to provide an SSCCE that demonstrates what you're talking about.

Similar Threads

  1. Can i call init() method in destroy method.?
    By muralidhar in forum Java Servlet
    Replies: 1
    Last Post: October 22nd, 2010, 12:18 PM
  2. Replies: 0
    Last Post: April 17th, 2010, 09:29 AM
  3. How do you pass an Array as a Parameter?
    By Arius in forum Java Theory & Questions
    Replies: 1
    Last Post: January 23rd, 2010, 09:36 PM
  4. How to Pass unlimited Arguments to a Function
    By neo_2010 in forum Java Programming Tutorials
    Replies: 2
    Last Post: July 8th, 2009, 12:39 PM