0
I don't understand what's wrong with my code.
public class MyClass { public static void main(String[ ] args) { try { System.out.println(bla); } catch (Exception e) { System.out.println("Error"); } } }
4 ответов
+ 2
You haven't declared bla which is a compile-time error, not a runtime exception. Try/catch is for runtime.
+ 1
Nope.
bla isnt declared, so your code doesn't even compile.
Try something like that instead:
String a = null;
a.length();
0
Should outprint error
0
Ok thanks both of you i understand it now