Your confusion seems to be why a question gets downvoted, even though it appears to be useful to you as a beginner. For this I'll quote myself:
A downvote does not mean "you are a bad person and you should feel bad, go die in a corner". But that's how they're often understood. Try to see SE as a collaboratively edited knowledge base. New entires are created on an as-needed basis by actual users having actual problems, and they're collectively solved and answered and preserved for posterity. Upvotes and downvotes are used as an indicator for how useful overall a certain "article" is in the grand scheme of things in the context of a knowledge base.
See it from the perspective of a future visitor who has a specific problem and is using the search feature to look for articles that may help him (a feature which is sorely underused by "newbs" by the way). What that user wants is the most useful article which is both not too specific to somebody else's code but fits his problem perfectly. He does not want to sift through a ton of vague single-sentence questions with code walls to figure out whether that particular article fits his problem or not. But that's what most downvoted questions are: they're either too specific or too vague or too long to comprehend or have some other criterium which makes them unsuitable to be a highly visible knowledge base article.
https://meta.stackoverflow.com/a/253230/476
You can create questions at any skill level, but we expect that question to be generally useful to anybody, including future visitors. If the question got downvoted it's probably not useful to anyone except the OP right here right now or is otherwise misleading or does not add any generally useful knowledge to the pool, and we're trying to unclog the system from questions which are unlikely to provide any help in the future.
To be bluntly honest: we do not want super basic questions which can and should be answered by a tutorial, manual or programming introduction course, if at all avoidable. SO is the resource you go to when the manual and all of Google has failed you; we do not want to clog up the system with a copy of every manual for every programming language in existence in triple copy. If such a question makes it into the system, it should at least be of such high quality that it can stand the test of time and be helpful for thousands of future newbies.
In this particular case the question may be somewhat salvageable by rephrasing it and making it clearer what the OP wants to know right from the title on (which can admittedly be hard for a newbie who doesn't have the right lingo), but the question is about such a basic misconception that I'm not sure anyone in the future will encounter the same problem.