nvseenu's answer is good but I like varargs. In your getParameter
method
{
String user = .... // all the parameters
.
.
.
// then
validate(user, pwd, ...) // and all this may look big but with auto-completion
// it's not a big headache
}
private void validate(String... parameters) {
for(String parameter : parameters) {
if(parameter == null || "".equals(parameter)) {
System.exit(0); // but it's bad IMO
}
}
return;
}