As has been mentioned in comments, your answers can be downvoted for whatever reasons anyone feels like. The community as a whole does have things that are generally considered "good" reasons for downvoting and "bad" reasons for downvoting, but at the end of the day nobody will ever enforce them as rules, you just might make people mad at you (or intentionally try to counter your votes by doing the opposite).
As for whether or not it's a good idea to post an answer that's not in the same language the OP is tagged with, that depends a bit. Some questions are sufficiently general, and the answers are not using particularly unique language features, that it can still be quite useful even if it's in the "wrong" language. In some cases having an answer in a different language can be considered "pseudocode" and would be used to demonstrate a higher level approach, without intending to be a copy/paste solution.
On the other side of things, if the question is highly tied to a language, or an answer is using language features so closely tied to that language that it is not useful in any other contexts, then your answer is less likely to be helpful and will plausibly result in downvotes as a result.
Just keep in mind that no matter what you do, I will always downvote you. Just because.