In the first instance bad questions should be down-voted.
Secondly, if you really think a bad question should be closed, then:
"Unclear what you are asking"
would seem to be the most appropriate close reason.
If that doesn't sit well, just select "off Topic > Other" and enter your own custom close reason.
I don't think your first case is close-worthy. Not a great question, but not close-worthy. I'm saying this while recognizing that opinions may differ, and I'm quite rusty with Java so maybe someone who uses Java day in and day out would could convince me otherwise.
The second case is quite close-worthy. It is not okay to post a question on SO where the information which is central to the question is made available only at the end of a link. In the question that you've linked to here, the input and output formats are both necessary to answering the question but they are not in the body of the question. I usually close these as "unclear what you are asking." (There may be other good reasons to close it but I select the close reason which requires the least interpretation on my part.)
In other cases, you may need to use a custom close reason and be prepared to live with being challenged about it if you are a little too creative with your reason. One common case I've encountered where I chose a custom close reason is when someone asks a question which is primarily a legal one.
From the given question:
for some reason it is not the rest of the code works properly.
'Not working' is, generally speaking, not a good problem description. So 'me have de kodez, me work not' questions are good candidates for Unclear what you're asking.
There's also a nice Off-Topic reason: it lacks sufficient information to diagnose the problem. This one is good when it's clear what the OP is asking (fix de kodez 4me), but it lacks the information what a particular problem does the OP has. No information what error there is, what is the difference between expected and actual output, no minimal example.
If it seems that the OP lack basic programming skills and even the simplest things can be a potential problem, I'd give too broad because the answer would have to be a programming tutorial.