Why do people not do their own homework?
- They're lazy or they aren't interested in learning
- Their behavior is almost always reinforced by copy/paste answers
How do we discourage people from answering?
That seems almost impossible.
I think we should try to discourage copy/paste answers to useless/duplicate questions that show no effort.
Maybe we could reward less (or no) reputation for answers to closed questions.
Or maybe answers to upvoted questions should be worth more points.
Another way is to encourage quality answers that provide more than just a snippet of code to copy/paste.
And... If a question shows no effort, vote to close it.
My approach:
If a question smells like it came from a lazy student (but has potential value to others), I try to add a small twist to my answer that prevents the OP from copy/pasting it.
You can usually find a way to provide an answer that will help anybody who wants to understand and/or learn, but will not help those who are trying to avoid learning.
Sometimes all you have to do is break the important logic out into a sub-routine or a simple class. Your answer will still be clear to future visitors, but the OP will have to understand the most basic principles to finish his homework. (he might even learn something!)
Note that I only do this when it's obvious that the site is being used to mindlessly complete homework. When someone asks a high quality question, the best thing to do is give them the exact answer they're looking for.
The other thing I try to do is to steer students and newbs towards the right tools to help them teach themselves. For Java questions, this means pointing them towards the API documentation and encouraging them to look there before asking a question.
Learning how, when, and where to consult the documentation is one of the most valuable things you can learn as a programmer.