Java exception | SoloLearn: Learn to code for FREE!

+2

Java exception

why my code isnt catching exception public class Program { public static void main(String[] args) { try{ String x=5; System.out.println(x); } catch(Exception e){ System.out.println("Errir"); } } }

5/28/2020 5:57:39 PM

Abdul Majeed Faraz

5 Answers

New Answer

+1

Yeah, an error usually means an unexpected (mis)behavior of an application. An exception is either part of error handling or error prevention.

+2

oh ok thanks for the answer

+1

This bug leads to a compiler error, which prevents from building any executable software.

+1

are error and exception different things?

+1

You're welcome