In Php I really often use this one:
$conn_sets = array();
$conn_sets['login'] = "aaa";
$conn_sets['pass'] = "bbb";
How to do the same in JAVA 1.6. I tried to do this:
private method1() {
String[] mystring = new String[] {"login" => "aaa", "pass" => "bbb"};
}
But it give's me an error. I want to make this work, because I have an error lists declarations, and it is better to identify:
throw new MyException(myerrors['failed_login_error']);
than a:
throw new MyException(myerrors[116]);
I know I can do a new class, and throw an object:
throw new MyException(ERROR_CONSTANTS.FAILED_LOGIN_ERROR);
But I prefer the first one (the same as I use in Php).
So, any ideas?