0

Can you change the error output of a code

code playground

12th Nov 2017, 10:44 AM
Keon
5 Answers
+ 32
What code?
12th Nov 2017, 11:00 AM
Igor Makarsky
Igor Makarsky - avatar
+ 10
Post your code here.
12th Nov 2017, 12:43 PM
qwerty
qwerty - avatar
+ 4
If it is compile error then no. If runtime error then yes
12th Nov 2017, 11:00 AM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 2
where's your code ?
12th Nov 2017, 4:16 PM
Talluri Saisumanth
Talluri Saisumanth - avatar
+ 1
In Java, yes. Using the try/catch block (below), you can execute another set of code (example: an output message) if one set fails (Exception handling). Like @Eligijus Sikartas said, this only works for a runtime error. A compiling error cannot be changed. public class JError{ public static void main(String[] args){ try{ File file=new File(C:\Photos\NonExistentImage.png); } catch (Exception e){ System.out.println("Error! File not found!"); } } }
12th Nov 2017, 1:14 PM
Jacob Duelz
Jacob Duelz - avatar