Sure, there is even a built in site feature to allow you to post an answer to your question before you have even posted your question. If you think that what you have found will be helpful to others, this is an entirely appropriate thing to do when you have had a problem.
However, writing self answered questions is actually quite hard. Here are several points to keep in mind:
The question and answer will be evaluated individually. The question needs to be a good question that meets this site's standards, even if you're answering the question yourself. Many people tend to effectively write up a tutorial/blog post and just stick a one sentence, "What is Foo?" type of question at the top. That's just not appropriate here. If the question wouldn't meet the site's standards if posted without your answer, then it shouldn't be posted with an answer.
Recognize that other people may decide to answer the post. They may feel that your answer isn't the best answer to the question. That is fine.
Sometime you end up writing an answer that is using information not in the question. This is really something you should be avoiding. Generally it's a sign of problems in the question, not the answer, but you often notice these problems when reading through the answer.