try and catch , why is giving error?? (READ PLZ)
in
Programming Questions
•
1 month ago
hi
why is the following code with error;
and if u know can u tell me a solution, plz
:D
- import java.util.Map;
- Map<Integer,Map<Integer,Boolean>> a = new HashMap();
- Map<Integer,Boolean> b = new HashMap();
- b.put(1,false);
- a.put(5,b);
- Map<Integer,Boolean> c = a.get(5);
- try {
- boolean d = c.get(2);
- } catch (IOException e) {
- e.printStackTrace();
- boolean d = c.get(1);
- }
im i using catch for wht he is not made to do.
any way my goal why try and catch, is that: if anything on try fail(error), the program will run catch
ty
:D
1