How to search for a phrase

edited November 2017 in Programming Questions

I'm getting an error message in my code so I searched for the error "Cannot make a static reference to a non-static method" instead of finding threads about my message it shows me every thread that has each word in it. There's a lot of threads with "a' in them. I also tried searching for just some key words, static or non-static but I also get lots of unrelated threads.

I assume I am doing something wrong but can't figure out what. How do I limit my search to just the error message.

Thanks John

Tagged:

Answers

  • "Cannot make a static reference to a non-static method"

    Probably you're attempting to access a method w/o 1st instantiating its class. :-@

  • @Stumpy_L:

    Forum search is terrible -- it doesn't work for multi-word phrases, as you note.

    https://www.google.com/search?q=processing.org+"Cannot+make+a+static+reference+to+a+non-static+method"

    Search google for the phrase (which will give you general Java advice beyond processing)

    ...or use Google to search processing.org, like this:

    "non-static method" site:processing.org

  • Answer ✓

    Thanks both for the help and I figured out my problem.

    First searching thru Google referencing the site works great. Amazing that you have to go outside to look in.

    The problem was in my call to the class. My class is "Player" and I had declared it and initialized my variable with "player = new Player();"

    But when I tried to send data to a method within the class with this line

    "Player.updatePlayer(xdelta, ydelta);" I got the error. I had capitalized the "P" in my variable, the class is capitalized not my variable. GoToLoop mentioned I wasn't declaring it. I checked that I was then saw my mistake.

    It should have been "player.updatePlayer(xdelta, ydelta);" and now it works fine.

    Thanks for the help John

  • What i find helpful is the tag system on this forum. If you tag this thread with "non-static" you can click that tag and get other threads that is tagged with the same.

    Then in the url lune of your browsen the url will end with something like: tag="non-static" Just change what's between the quotes to search for other tags :)

    It's not great, but it works.

  • Great tip, I'll give it a try.

    Thanks John

Sign In or Register to comment.