The more information you provide, the easier it is for people to answer your questions. Consider these examples:
[not helpful] My program throws an error.
[better] My program throws a NullPointerException on line 13. Below is the code and the stack trace.
The better one provides the reader with everything he/she needs to know to answer your question. Helpful information, if applicable, includes:
Detailed description of problem
what you did
what you expected to happen
why you expected it to happen
why you need it to happen
what actually happened instead and
why what happened is a problem to you
Version numbers of relevant libraries, JDK, tools, operating system etc.
What else you tried/what worked/what didn't work
Don't take this as a checklist that you need follow though. It is rather meant as an inspiration on what might be interesting to the people who want to help you. Taking the time to present all of the relevant information demonstrates that you are willing to ShowSomeEffort when presenting your question. Doing so makes it much more likely that someone else will expend some effort to help you.
It is also possible to provide too much extra information. For example, if you have a 500 line program, go through it and only post the relevant pieces. Try to narrow your problem down as much as possible.
[best] My program throws a NullPointerException. Below are the 10 lines of code that don't work. It should calculate the answer to the final question of life, the universe and everything. As you can see from the stacktrace, though, it is throwing the NullPointerException at line 4. I think that is because the mice aren't yet initialized, though I'm doing that in line 1. When I'm initializing them inside the loop (line 3), it runs without the Exception, but of course generates the wrong answer ("41"). I'm using the Universal Question Resolver 0.0.1 beta 3 on JDK 1.7.