• Teaching
    • Montessori Teacher Training 🔥
    • Yoga Teacher Training
  • Coding
    • Full Stack Development Course
    • Data Science Course
    • Python Programming Course
    • Software Testing Course
    • Architecting on AWS
  • Commerce
    • PwC Edge : Strategic Accounting and Finance Programme
    • ACCA Course
    • SAP Fico Course
    • Practical Accounting Course
    • SAP MM Course
    • HR Management Course in Kerala
  • Technical
    • Structural Design Course
    • Embedded Systems Software Engineering in Kerala
    • MEP Course
    • MEP QS Course
    • BIM Training Course
    • Quantity Survey Course
  • Finacademy
    • Forex Trading Course
    • Stock Market Course
    • Mutual Funds Course in Kerala
  • Digital Marketing
    • Digital Marketing Course
    • Performance Marketing Course
  • Language Learning
    • Spoken English Course
    • German Language Course
    • IELTS Exam Coaching
  • Exam Preparation
    • Kerala PSC Coaching
    • Kerala PSC LGS Coaching
    • KAS Coaching
    • Kerala PSC LDC Coaching
    • Kerala PSC LSGS Coaching
    • KPSC Industries Extension Officer Coaching
    • KPSC Technical Mechanical Coaching
    • KPSC Technical Electrical Coaching
    • Kerala PSC Technical Exam Preparation
    • KPSC Technical Civil Coaching
    • SBI PO Coaching
    • IBPS Clerk Coaching
    • IBPS PO Coaching
    • IBPS SO Coaching
    • Bank Exam Coaching
    • Lecturer in DIET Course
    • Kpsc HSA Coaching
    • KPSC LP UP Assistant Coaching
    • EMRS Coaching
    • KTET Coaching
    • SSC Coaching
    • SSC JE Coaching
    • SSC CGL Coaching
    • SSC CHSL Coaching
    • SSC MTS Coaching
    • UPSC Coaching
  • Health Care
    • DHA Course
    • OET Coaching
  • Other Exams
    • GATE Coaching
    • CAT Coaching
    • MAT Online Coaching
    • KMAT Online Coaching
Entri Blog
No Result
View All Result
Thursday, May 15, 2025
  • Kerala PSC
    • Kerala PSC General
      • Kerala PSC Exams
      • KAS Exam
      • Kerala PSC VEO Notification
      • Kerala Police SI
      • Kerala PSC LDC Notification
      • Kerala PSC Village Field Assistant Notification
      • Kerala PSC LD Typist Notification
      • Kerala PSC Food Safety Officer
      • Kerala PSC Excise Inspector Notification
      • Kerala PSC BDO Notification
      • Kerala PSC CPO Notification
      • Kerala PSC LGS Notification
      • Fire and Rescue Officer
      • Women Fire and Rescue Officer
    • Kerala PSC Teaching
      • Kerala PSC HSA
      • Kerala PSC HSST
      • KTET
      • LP/UP Assistant
      • KVS
      • Railway Teacher
    • Kerala PSC Technical
      • LSGD AE
      • Draftsman/Overseer
      • IEO
      • ATP
      • Polytechnic Lecturer
      • AE Electronics
      • Assistant Engineer
  • Banking
    • IBPS PO Notification
    • IBPS Clerk Notification
    • SBI PO Notification
    • SBI Clerk Notification
    • SBI SO Notification
    • SBI Apprentice Notification
    • Canara Bank PO Notification
    • Indian Bank PO Notification
    • RBI Assistant Notification
    • RBI Office Attendant Notification
    • IBPS RRB Notification
    • IBPS RRB Office Assistant Notification
  • Skilling
    • Coding
    • Spoken English
    • Stock Market
      • Share Market Today News
      • Share Market Analysis
    • Digital Marketing
    • Accounting Course
    • SAP
    • OET
    • German
    • IELTS
    • Quantity Survey
    • MEP
    • Structural Design
    • Montessori
    • Yoga Teaching
    • Oil and Gas
  • Courses
    • Data Science Course
      • Data Science Malayalam
      • Data Science Course in Tamil
      • Data Science Course in Telugu
      • Data Science Training in Kochi
      • Data Science Training in Trivandrum
      • Data Science Course in Calicut
      • Data Science Training in Thrissur
    • Data Analytics Course
      • Data Analytics Course in Malayalam
      • Data Analytics Course in Tamil
      • Data Analytics Course in Telugu
    • Technical Upskilling
      • Quantity Surveying Course
      • Structural Design Course
      • BIM Course in Kerala
      • MEP Course
      • Embedded System Course
      • MEP Quantity Surveying Course
      • MEP Course in Kochi
      • Quantity Surveyor Course in Tamil
      • Quantity Surveying Course in Telugu
      • Quantity Surveyor Course in Hyderabad
      • Quantity Surveying Course in Chennai
      • MEP Design Course in Kerala
      • HVAC Course
      • Steel Structure Design Course
      • RCC Design Course
    • Full Stack Developer Course
      • Full Stack Development Malayalam
      • Full Stack Development Hindi
      • Full Stack Development Tamil
      • Full Stack Development Telugu
      • Full Stack Development Kannada
    • Stock Market Course
      • Stock Market Course in Malayalam
      • Stock Market Course in Tamil
      • Stock Market Course in Kannada
      • Options Trading Course
    • Mutual Funds Course
    • Forex Trading Course
    • Spoken English Course
      • Spoken English Course in Malayalam
      • Spoken English Course in Hindi
      • Spoken English Course in Telugu
      • Spoken English Course in Tamil
      • Spoken English Course in Kannada
    • Python Programming Course
    • Software Testing Course
      • Software Testing Course in Malayalam
      • Software Testing Course in Tamil
      • Software Testing Course in Telugu
    • AWS Solutions Architect Associate Course
    • PwC Edge : Strategic Accounting and Finance Programme
    • Practical Accounting Course
      • Accounting Course in Malayalam
      • Accounting Course in Tamil
      • Tally Course
      • Taxation Course
      • UAE Accounting
      • GST Course
      • Zoho Books Training
      • GST Practitioner Course in Kerala
      • GCC VAT Course
    • ACCA Training Online
      • ACCA Course in Kerala
    • SAP Training Courses
      • SAP FICO Course
      • SAP MM Course
      • SAP SD Training
      • SAP FICO Course in Tamil
      • SAP MM Course in Tamil
    • HR Management Course
    • Performance Marketing Course
    • Mern Stack Developer Course
      • Full Stack Developer Course in Kochi
      • Full Stack Developer Course in Trivandrum
      • Full Stack Developer Course in Calicut
      • Full Stack Developer Course in Pune
      • Full Stack Developer Course in Bangalore
      • Full Stack Developer Course in Hyderabad
      • Full Stack Developer Course in Chennai
      • Full Stack Developer Course in Indore
      • Full Stack Developer Course in Jaipur
      • Full Stack Developer Course in Coimbatore
    • Digital Marketing Training
      • Digital Marketing Course in Kochi
      • Digital Marketing Course in Trivandrum
      • Digital Marketing Course in Calicut
      • Digital Marketing Course in Kollam
      • Digital Marketing Course in Thrissur
      • Digital Marketing Course in Kottayam
      • Digital Marketing Course in Kannur
    • Montessori Teacher Training
      • Montessori Teacher Training in Calicut
      • Montessori Teacher Training in Kochi, Ernakulam
      • Montessori Teacher Training in Trivandrum
      • Montessori Teacher Training in Kollam
      • Montessori Teacher Training in Malayalam
      • Montessori Teacher Training in Kannada
    • Other Courses
      • German Language Course
      • OET Coaching
        • OET for Pharmacist
        • OET for Nurses
      • DHA Course
      • MOH Exam Coaching
      • Nurses Recruitment Abroad
      • FMGE Coaching
      • ChatGPT Course
      • Forex Trading Course
      • Yoga Teacher Training Course
      • Diploma in Early Childhood Care and Education
      • Business Administration & Hospital Management Course
      • Hospital and Healthcare Administration
      • AI for Teachers Course
  • Others
    • Railway
      • RRB Technician Notification
      • RRB JE Notification
      • RRB ALP Notification
      • RRB NTPC Notification
      • RRB RPF Notification
      • RRB RPF SI Notification
      • RRB RPF Constable Notification
      • RRB Group D Notification
      • RRB RPSF SI Notification
      • RRB SSE Notification
    • SSC
      • SSC CPO Notification
      • SSC MTS Notification
      • SSC CGL Notification
      • SSC CHSL Notification
      • SSC GD Constable Notification
      • SSC Stenographer Notification
      • SSC JE Notification
      • SSC CAPF Notification
      • SSC JHT Notification
      • Delhi Police Constable Notification
      • Delhi Police SI Notification
    • GATE
    • MAT
    • KMAT
      • KMAT Kerala 2024
    • TET
      • APTET
      • CTET
      • DSSSB
      • Karnataka TET
      • Kerala TET
        • KTET Notification
      • KVS
      • MPTET
      • SUPER TET
      • TNTET
      • TSTET
      • UPTET
    • UPSC
      • UPSC CAPF Notification
      • UPSC CDS Notification
      • UPSC NDA Notification
      • UPSC Civil service Notification
  • Free Learn
    • Free Courses
      • Free Coding Courses
        • C Langauge Courses
        • Free Data Science Courses
        • Free Full Stack Developer Courses
        • Free Python Programming Courses
      • Free Accounting Courses
      • Free Digital Marketing Courses
        • Free SEO Courses
        • Web Development for Marketers
      • Engineering Upskilling Courses
      • Free Hospital Administration Courses
      • Free OET Training
      • Free SAP Courses
      • Free Teachers Training Courses
      • Free Trading Courses
        • Free Stock Market Courses in Malayalam
        • Free Options Trading Course Malayalam
        • Free Forex Trading Courses Malayalam
        • Free Personal Finance Courses Malayalam
    • Question Answer
    • Aptitude Questions
    • Webinars
  • Test Prep
    • Kerala PSC Coaching
      • KPSC Degree Level Exam Preparation
      • Kerala PSC 12th Level Exam Preparation
      • Kerala PSC 10th Level Exam Preparation
      • KAS Coaching
      • Kerala PSC LDC Coaching
      • Kerala PSC LD Typist Coaching
      • Kerala PSC Fireman Coaching
      • KSFE Assistant Exam Preparation
      • Secretariat Office Attendant Coaching
      • Secretariat Assistant Coaching
      • Kerala PSC SI Exam Coaching
      • Khadi Board LDC Exam Preparation
      • Devaswom Board LDC Coaching
      • University LGS Exam Preparation
      • University Assistant Exam Coaching
      • KPSC Scientific Officer Exam Coaching
      • KPSC Probation Officer Grade II
      • KPSC Food Safety Officer Coaching
      • KWA Sanitary Chemist Coaching
      • KPSC Diary Farm Instructor Exam Coaching
      • Kerala PSC KWA Lab Assistant Exam Coaching
      • Kerala PSC ICDS Supervisor Exam Coaching
      • KPSC Finger Print Searcher Coaching
      • Kerala PSC Welfare Officer Gr. II Exam Coaching
      • KPSC Assistant Dental Surgeon Coaching
    • KPSC Teaching Exams
      • HSA Exam Preparation
      • KPSC HSA Social Science Coaching
      • KPSC HSA Physical Science Coaching
      • KPSC HSA English Coaching
      • KPSC Junior Language Teacher Hindi
      • KTET Coaching
      • SET Coaching
      • LP/UP Assistant Exam Coaching
      • HSST Exam Preparation
      • HSST Commerce Exam Coaching
      • Kerala PSC Lecturer in Diet Coaching
      • KVS PGT/TGT Coaching
    • Kerala PSC Technical Exams Coaching
      • Assistant Engineer Electrical Exam Coaching
      • Assistant Engineer Electronics Coaching
      • Assistant Engineer Mechanical Coaching
      • Kerala PSC Industries Extension Officer Coaching
      • KPSC LSGD AE Exam Coaching
      • KPSC Civil Engineering Exam Coaching
      • KPSC Mechanical Engineering Exam Coaching
      • KPSC Electrical Engineering Exam Coaching
      • KPSC Electronics Engineering Exam Coaching
      • KPSC Technical Computer Science Coaching
      • KPSC Tradesman Turning Coaching
      • Kerala PSC Overseer Exam Coaching
      • KPSC Assistant Town Planner Coaching
      • Lecturer in Polytechnic Electronics Coaching
    • Teaching Exams Coaching
      • CSIR NET Exam Coaching
      • EMRS Coaching
      • CTET Exam Online Coaching
    • IELTS Training Online
    • Bank Exam Coaching Online
      • SEBI Grade A Coaching
      • IBPS SO Online Coaching
      • IBPSC PO Online Coaching
      • IBPSC Clerk Online Coaching
      • SBI PO Coaching
      • SBI Clerk Online Coaching
      • SBI Apprentice Class
      • SBI SO Online Coaching
      • RBI Grade B Coaching
      • RBI Assistant Coaching
      • CSEB Exam Coaching
      • IBPS RRB Coaching
      • IBPS RRB PO Coaching
      • Canara Bank Po Exam Coaching
      • Kerala Gramin Bank Coaching
      • Kerala Bank Exam Coaching
        • Kerala Bank Clerk Exam Coaching
        • Kerala Bank Office Attendant Exam Coaching
        • Kerala Bank Assistant Manager Exam Coaching
      • JCI Exam Coaching
      • NABARD Grade A Coaching
      • LIC AAO Coaching Online
    • UPSC Online Coaching
      • UPSC CAPF Online Coaching
    • SSC Online Coaching
      • SSC JE Online Coaching
      • SSC CGL Coaching
      • SSC CGL AAO Coaching
      • SSC CGL CBI Inspector Coaching
      • SSC CHSL Coaching
      • SSC MTS Coaching
      • SSC Stenographer Coaching
      • SSC GD Online Coaching
    • RRB Exams Coaching
      • RRB RPF Exam Coaching
      • RRB NTPC Exam Coaching
      • RRB JE Online Coaching
      • RRB JE Electronics Coaching
      • RRB ALP Exam Coaching
      • RRB Technician Exam Coaching
    • CAT Online Coaching
    • CMAT Online Coaching
    • XAT Exam Coaching
    • GATE Online Coaching
      • GATE CE Online Coaching
      • GATE ME Online Coaching
      • GATE EE Online Coaching
    • NMAT Exam Coaching
    • AAI ATC Jr Executive Coaching
    • Cochin Shipyard Executive Trainee Coaching
    • BEL Probationary Engineer Coaching
    • HPCL Junior Executive Coaching
Free Courses
Entri Blog
  • HTML Tutorial
  • DSA Tutorials
  • Tutorials in Hindi
    • HTML Tutorial for Beginners in Hindi
    • Python Tutorial for Beginners in Hindi
    • GIT and GITHUB Tutorial for Beginners in Hindi
  • Tutorials in Tamil
    • JavaScript Tutorial in Tamil
  • Tutorials in Telugu
    • HTML Tutorial For Beginners in Telugu
    • CSS Tutorial for Beginners in Telugu
    • Bootstrap Tutorial for Beginner in Telugu
  • Tutorials in Kannada
    • HTML Tutorial For Beginners in Kannada
entri exclusive offers entri exclusive offers
Home Articles

Why Tracking and Monitoring All Exceptions is Important

by Feeba Mahin
June 19, 2022
in Articles, Java Programming
Why Tracking and Monitoring All Exceptions is Important
Share on FacebookShare on WhatsAppShare on Telegram

Modern applications are complex multi-tier and multi-layer systems that consist of multiple client-side apps, web servers, application servers, and database servers. The applications use third-party libraries, communicate with other applications using different communication mechanisms, and rely on cloud services and hosting providers.

Python and Machine Learning Rectangle

How can you manage that complexity? Your first thoughts probably go to application monitoring and performance tools. Yet that is not a complete solution. To manage application complexity fully, you also need exception monitoring. Without exception monitoring, you’ll never stay ahead of the complexity of modern applications.

Let me explain why?

Troubleshooting and optimizing your code is easy with integrated errors, logs and code level performance insights.

Grab the opportunity to learn Java with Entri! Click Here

Access to failure data

Lots of monitoring tools exist to help you identify and troubleshoot issues across all application layers. However, most of these tools are designed to show you the overall system state. Only logs, and exceptions in particular, offer insight into a finer level of detail.

By definition, an exception is an event which occurs during the execution of a program that disrupts the normal flow of the program’s instructions.

Exceptions are used to indicate many different types of error conditions across all the application layers: out of memory, stack overflow, IO problems, null pointer exceptions, network timeouts, and many others. They could indicate system problems, problems in application logic, operating system problems, connectivity problems, and so on.

When an exception occurs within a method, the method creates an object and hands it off to the runtime system. The exception object contains information about the error, including its type and the state of the program when the error occurred. Therefore, exceptions— handled or not—provide access to very useful raw data that can be used for:

  • Early error detection and prevention
  • Root cause analysis when problems occur
  • Reconstructing events after a problem occurred
  • Identifying security problems
  • Forensic evidence

Ace your coding skills with Entri !

Early problem detection

1: What is the default value of a boolean in Java?

2: What is the TreeSet Interface?

3: Which loop construct in Java best suits when the number of iterations is known?

4: What is the size of a byte variable?

5: Which of the following is thread safe?

    Fill out the form to see the results

    Ever wondered how much you really know? It's time to put your brain to the test!

    Many production problems build up gradually. Monitoring tools can often provide an indication that something is awry by monitoring metrics such as CPU load, RAM and storage access and network activity and connectivity, but that information alone can generally not be used to pinpoint the source of a problem. As a result, you run the risk of waiting until a problem becomes critical before you begin looking for the source.

    Exception monitoring offers another better way of gaining early insight into production problems. By monitoring exceptions, you can trace a performance issue to its root case, thereby gaining the time and means to spot the problem before it reaches a tipping point and impacts your users or company.

    Grab the opportunity to learn Java with Entri! Click Here

    Explore Free Coding Courses !

    Take your first step toward mastering in-demand skills, acing interviews, and securing top-tier jobs with Entri's free coding courses.

    👉 Explore Free Courses Now

    Impact on application performance

    Quite often, an app throws a lot of exceptions that might be harmless in terms of application functionality. Sometimes they are even referred to as “good” exceptions.

    However, exception throwing requires stack trace propagation, which basically means that your app pauses to walk back the stack to collect information which will be used to create the stack trace. While this timeout in thread execution is insignificant as a singular event, it can create huge performance overhead on a large scale.

    Therefore, “good” exceptions can have a major impact on an application’s performance, and shouldn’t be left unattended.

    Ace your coding skills with Entri !

    Exception Tracking  and security

    Also worth noting is how important exception monitoring is from a security perspective. Following are a couple of reasons why.

    Hackers can use information exposed by error messages

    Application failure often results in throwing an exception. Detailed error messages can provide attackers with useful information such as stack traces, privacy information, and sometimes even passwords, which can lead to security vulnerabilities such as enumeration, buffer attacks, sensitive information disclosure, etc. Even HTTP 404 can expose your server to attacks. While good code is supposed to not allow exceptions to go unhandled, in practice, it’s nearly impossible to anticipate all the cases when an exception could be thrown, and control its content. Furthermore, with all honesty, error handling is rarely robust enough to survive a penetration test. Therefore, actively monitoring your logs for this kind of exposure and taking action to fix it immediately can prevent hacker attacks and drastically improve your system’s security.

    Grab the opportunity to learn Java with Entri! Click Here

    Explore Free Coding Courses !

    Take your first step toward mastering in-demand skills, acing interviews, and securing top-tier jobs with Entri's free coding courses.

    👉 Explore Free Courses Now

    Identifying hacker attacks  

    In spite of all your efforts, if your system has been hacked, logs are often the only record that suspicious behavior is taking place, even if the system still works fine and all the monitoring tools show no problems.  For this reason, monitoring exceptions may be your best shot at identifying when your system is being hacked.

    The specifics of identifying such suspicious behavior depend on your application’s functionality, but generally you should be looking for any sign of abnormalities in your log files: new error messages and exceptions that could indicate elevation of access privileges, bulk downloads, privacy violations, etc.

    Logs are also useful in reconstructing events after a problem has occurred, and as forensic evidence. Event reconstruction can allow a security administrator to determine the full extent of an intruder’s activities and expedite the recovery process.

    Troubleshooting and optimizing your code is easy with integrated errors, logs and code level performance insights.

    Ace your coding skills with Entri !

    Types of Exceptions in Java – Checked, Unchecked, & Error

    Now, we will learn about the different types of exceptions in Java checked exceptions, unchecked exceptions, and errors.

    Exceptions can happen in any scenario, and all developers would have come across exceptions, for example, whenever we try to read a file that doesn’t exist or whenever we try to read the elements in an array beyond its size and so on.

    It is always better to know which exception occurs in which situation so that we will have better control in handling the exception.

    Ace your coding skills with Entri !

    Types of Exceptions in Java

    Exceptions can be divided into three main categories

    1. Checked exceptions (Compile-time exceptions)
    2. Unchecked exceptions (Runtime exceptions)
    3. Errors

    Types of Exceptions in Java
    All the exceptions descend from the Throwable class, and then the hierarchy splits into two branches Error and Exception.

    Error hierarchy describes the internal error or any resource exhaustion or any other malfunction which happens in the JVM. On the other hand, the Exceptions branch further splits into two IOException and Runtime exceptions.

    Except for the Error and RuntimeException and its subclasses, all other classes will be a part of Checked Exception (Compile-time exception).

    Checked Exception happens on the occurrence of events which is beyond the control of the JVM like File not present or reading from the database where there might be a situation that the database is down etc.

    Whereas Runtime Exception happens due to bad programming such as not handling null properly, dividing a number by zero, etc.

    Grab the opportunity to learn Java with Entri! Click Here

    1. Checked Exception or Compile Time Exception

    A Checked Exception or Compile-Time Exception is a subclass of the java.lang.Exception but not a subclass of java.lang.RuntimeException.

    Checked Exception is the exception that will be checked during the compile-time, if a method throws a checked exception then the calling method must have one of the below

    • A try-catch block to handle the exception

    (or)

    • Throw the exception using throws keyword in the method signature

    A checked exception occurs whenever we are doing some operation that is not in the control of the JVM.

    For example, Let’s try to open a file.

    package com.javainterviewpoint;
    
    import java.io.FileInputStream;
    
    public class FileRead
    {
       public static void main(String[] args)
       {
          FileInputStream fileInputStream = new FileInputStream("test.txt");
       }
    }

    The above code throws a compile-time exception “FileNotFoundException”, as there can be a possibility of file not present at the mentioned location.

    When we look at the constructor of FileInputStream,

    public FileInputStream(String name) throws FileNotFoundException {
            this(name != null ? new File(name) : null);
        }

    The declaration says that the above constructor produces the FileInputStream object using the string parameter passed, and in case of any issues, it will throw FileNotFoundException.

    Types of Exceptions in Java - Checked Exception

    In order to make the above code work we need to enclose it in the try-catch block or throw the exception

    package com.javainterviewpoint;
    
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    
    public class FileRead
    {
       public static void main(String[] args)
       {
          try
          {
             FileInputStream fileInputStream = new FileInputStream("test.txt");
          } catch (FileNotFoundException e)
          {
             e.printStackTrace();
          }
       }
    }

    2. Unchecked Exception or RunTimeException

    A Runtime Exception or Uncheck Exception is a subclass of java.lang.RunTimeException class. Runtime exception usually occurs because of bad programming or programming error.

    Since the Unchecked exceptions happen during the run time, we don’t need to throw the exception in the method signature, though we can do it but not mandatory.

    For example, NullPointerExecption is a type of RunTimeException which occurs when a variable is not assigned an object and still points to null.

    package com.javainterviewpoint;
    
    public class NullTest
    {
       public static void main(String[] args)
       {
          String name = null;
          System.out.println(name.length());
       }
    }

    The above code clearly shows that the exception occurred due to bad programming. A simple null check before performing any operation on the variable will sort out the issue.

    package com.javainterviewpoint;
    
    public class NullTest
    {
       public static void main(String[] args)
       {
          String name = null;
          if (name != null)
             System.out.println(name.length());
       }
    }

    Like the Checked exception, we can use a try-catch to catch the runtime exception.

    package com.javainterviewpoint;
    
    public class NullTest
    {
       public static void main(String[] args)
       {
          String name = null;
          try
          {
             System.out.println(name.length());
          } catch (NullPointerException ne)
          {
             System.out.println("NullPointerException has occured!!");
          }
       }
    }

    Grab the opportunity to learn Java with Entri! Click Here

    3. Error

    An Error is a subclass of java.lang.Error class. The Error indicates a severe issue that cannot be controlled through the code.

    For example, OutOfMemoryError occurs when the Java Heap space is full, StackOverflowError is another error which the JVM throws when the stack required for the program is higher than the memory allocated by the JRE.

    package com.javainterviewpoint;
    
    public class StackOverFlow
    {
       public static void main(String args[])
       {
          disp();
       }
    
       public static void disp()
       {
          disp();
       }
    }

    The above code eventually throws StackOverFlowError as the disp() method runs infinite number of times.

    Exception in thread "main" java.lang.StackOverflowError
    	at com.javainterviewpoint.StackOverFlow.disp(StackOverFlow.java:12)
    	at com.javainterviewpoint.StackOverFlow.disp(StackOverFlow.java:12)
    	at com.javainterviewpoint.StackOverFlow.disp(StackOverFlow.java:12)
    	at com.javainterviewpoint.StackOverFlow.disp(StackOverFlow.java:12)
    	at com.javainterviewpoint.StackOverFlow.disp(StackOverFlow.java:12)
    	at com.javainterviewpoint.StackOverFlow.disp(StackOverFlow.java:12)
    	at com.javainterviewpoint.StackOverFlow.disp(StackOverFlow.java:12)

    Tough Error represents a severe issue, and we should not handle it, we can still catch the Error like below.

    package com.javainterviewpoint;
    
    public class StackOverFlow
    {
       public static void main(String args[])
       {
          try
          {
             disp();
          } catch (StackOverflowError se)
          {
             System.out.println("StackOverflowError has occured!!");
          }
       }
       public static void disp()
       {
          disp();
       }
    }

    In Java, an Exception is essentially an event that occurs during the execution of a program and disrupts the program’s normal flow. Exceptions are unwanted and mostly unexpected, which generally arise at either run- or compile-time. All of these Exceptions need to be handled to ensure the program runs in its natural flow.

    However, before you handle Exceptions, it would help to know what different kinds of Exceptions are present with Java. Through this article, let’s look at the various types of Exceptions in Java and the Exception Hierarchy that they follow.

    Ace your coding skills with Entri !

    Exceptions Hierarchy in Java 

    The hierarchy of Exceptions in the Java programming language begins with the Throwable class – which comes from the Object class and is its direct subclasswhileThe Exception class presents all This Throwable class further branches into two subclasses – Error and Exception. Here’s a flowchart to understand the Java Exception hierarchy better:

    The Exception class presents all the Exceptions that you might need to handle while working with the Java programming language. Some commonly known and encountered examples of such Exceptions include NullPointerException, ClassNotFoundException, IllegalArgumentException, etc.

    On the other hand, the Error class takes care of more severe problems in your Java program architecture and is not taken care of within the application code. Some examples of errors in Java are InternalError, AssertionError, OutOfMemoryError, etc.

    Exceptions in Java are further divided into two categories:

    • Checked Exceptions – These are also known as compile-time exceptions.
    • Unchecked Exceptions – These are also known as runtime exceptions.

    One important point to note at this juncture is that unchecked Exceptions are all subclasses of the RuntimeException class. Now, let’s look at essentially how Errors and Exceptions differ in their working so that there is no confusion.

    Grab the opportunity to learn Java with Entri! Click Here

    Errors and Exceptions in Java – How Do They Differ?

    The official documentation of the Java programming language refers to Errors as occurrences during your Java programming that – “indicate serious problems that a reasonable application should not try to catch.” The seriousness of Errors is clear from the way this statement is poised. Clearly, this refers to the set of problems that your program might face that is not possible for it to recover from without either refactoring the code or modifying the Java application architecture.

    Let’s look at a Java method that is going to throw an error:

    public static void print(String S) {

    print(S);

    }

    In the code mentioned above, the method print() acts as a recursive method that keeps calling itself repeatedly, over and over again, until it reaches the maximum allowed size for a thread stack in Java. At that point, it exits execution with a very common – StackOverflowError, which reads something like:

    Exception in thread “main” java.lang.StackOverflowError

    at StackOverflowErrorExample.print(StackOverflowErrorExample.java:3)

    As the above example shows, the method throws an example, but this error cannot be handled in the code itself. So, the program simply quits execution because the damage is irrecoverable. As a solution, the code needs to be modified.

    Contrary to Errors, Exceptions indicate conditions that can be caught by a reasonable application. Exceptions in Java include issues that might occur either at the compile-time or during run time. These Exceptions happen rather frequently in all applications – especially during the testing and debugging phase. As a result, Exceptions in Java can be handled within the program itself to ensure that the code runs its natural flow.

    Ace your coding skills with Entri !

    Conclusion

    Please keep in mind that this is by no means comprehensive coverage of Exceptions in Java and how to go about handling them. For that, you should dig deeper and expose yourself to different possible Exceptions to see how they work. Knowing Exception Handling will set you up for a successful career as a full-stack developer since Exceptions form the basics of any application.

    Python and Machine Learning Square

    Share61SendShare

    Feeba Mahin

    Related Posts

    What to Eat Before and After Your Yoga Sessions
    Articles

    What to Eat Before and After Your Yoga Sessions

    May 15, 2025
    Hydration and Nutrition Tips for Intensive Yoga Practice
    Articles

    Hydration and Nutrition Tips for Intensive Yoga Practice

    May 15, 2025
    Difference Between MEP QS and Civil QS
    Articles

    Difference Between MEP QS and Civil QS

    May 15, 2025
    Next Post
    Rewa Solar Project - UPSC Notes PDF

    Rewa Solar Project - UPSC Notes PDF

    Latest Posts

    • What to Eat Before and After Your Yoga Sessions
    • Hydration and Nutrition Tips for Intensive Yoga Practice
    • Difference Between MEP QS and Civil QS
    • Survey Insights: Why People Fear the Stock Market and How to Beat It
    • What to Include in a UI/UX Portfolio: 10 Must-Have Elements

    Trending Posts

    • Kerala PSC Divisional Accountant Answer Key 2025 PDF

      Kerala PSC Divisional Accountant Answer Key 2025 PDF

      938 shares
      Share 375 Tweet 235
    • List of 28 States of India and their Capitals and Languages 2025 – PDF Download

      152679 shares
      Share 61069 Tweet 38168
    • List of Government Banks in India 2025: All you need to know

      66749 shares
      Share 26700 Tweet 16687
    • TNPSC Group 2 Posts and Salary Details 2025

      40394 shares
      Share 16158 Tweet 10099
    • New Map of India with States and Capitals 2025

      35802 shares
      Share 14320 Tweet 8950

    Courses

    • Data Science Course
    • Full Stack Developer Course
    • Software Testing Course
    • Data Science Course in Malayalam
    • Full Stack Developer Course in Malayalam
    • Full Stack Developer Course in Hindi
    • Full Stack Developer Course in Tamil
    • Full Stack Developer Course in Telugu
    • Full Stack Developer Course in Kannada
    • Python Programming Course
    • Practical Accounting Course
    • Structural Design Course
    • Quantity Surveying Course
    • Embedded Systems Course in Kerala
    • BIM Course
    • MEP Course
    • MEP QS Course
    • Stock Market Course
    • Stock Market Course in Malayalam
    • Stock Market Course in Tamil
    • Stock Market Course in Kannada
    • Forex Trading Course
    • Mutual Funds Course
    • PwC Edge : Strategic Accounting and Finance Programme
    • SAP FICO Training
    • SAP MM Training
    • SAP SD Training
    • ACCA Online Course
    • HR Management Course

    Company

    • Become a teacher
    • Login to Entri Web

    Spoken English Courses

    • Spoken English Course
    • Spoken English Course in Malayalam
    • Spoken English Course in Hindi
    • Spoken English Course in Tamil
    • Spoken English Course in Telugu
    • Spoken English Course in Kannada
    • Spoken English Course for Housewives
    • Spoken English Course for Working Professionals
    • Spoken English Course for School Students
    • Spoken English Course for College Students
    • Spoken English Course for Job Seekers
    • AI Powered Spoken English Course

    Quick Links

    • Explore Free Courses
    • Aptitude Questions
    • Articles
    • Videos
    • Entri Daily Quiz Practice
    • Current Affairs & GK
    • News Capsule – eBook
    • Preparation Tips
    • Kerala PSC Gold
    • Entri Skilling
    • Kerala PSC

    Other Courses

    • OET Coaching Classes
    • DHA Course
    • Nurse Recruitment Abroad
    • Montessori Teachers Training
    • Performance Marketing Course
    • German Language Course
    • Yoga Teacher Training Course
    • Digital Marketing Course
    • Options Trading Course
    • German Language A1 Course
    • German Language A2 Course
    • German Language B1 Course
    • German Language B2 Course
    • Diploma in Early Childhood Care and Education
    • Hospital and Healthcare Administration
    • Business Administration & Hospital Management
    • Hospital and Healthcare Administration

    Popular Exam

    • IBPS Exam
    • SBI Exam
    • Railway RRB Exam
    • Kerala PSC
    • Tamil Nadu PSC
    • Telangana PSC
    • Andhra Pradesh PSC
    • MPPSC
    • UPPSC
    • Karnataka PSC
    • Staff Selection Commission Exam
    • GATE

    © 2023 Entri.app - Privacy Policy | Terms of Service

    No Result
    View All Result
    • Kerala PSC
      • Kerala PSC General
        • Kerala PSC Exams
        • KAS Exam
        • Kerala PSC VEO Notification
        • Kerala Police SI
        • Kerala PSC LDC Notification
        • Kerala PSC Village Field Assistant Notification
        • Kerala PSC LD Typist Notification
        • Kerala PSC Food Safety Officer
        • Kerala PSC Excise Inspector Notification
        • Kerala PSC BDO Notification
        • Kerala PSC CPO Notification
        • Kerala PSC LGS Notification
        • Fire and Rescue Officer
        • Women Fire and Rescue Officer
      • Kerala PSC Teaching
        • Kerala PSC HSA
        • Kerala PSC HSST
        • KTET
        • LP/UP Assistant
        • KVS
        • Railway Teacher
      • Kerala PSC Technical
        • LSGD AE
        • Draftsman/Overseer
        • IEO
        • ATP
        • Polytechnic Lecturer
        • AE Electronics
        • Assistant Engineer
    • Banking
      • IBPS PO Notification
      • IBPS Clerk Notification
      • SBI PO Notification
      • SBI Clerk Notification
      • SBI SO Notification
      • SBI Apprentice Notification
      • Canara Bank PO Notification
      • Indian Bank PO Notification
      • RBI Assistant Notification
      • RBI Office Attendant Notification
      • IBPS RRB Notification
      • IBPS RRB Office Assistant Notification
    • Skilling
      • Coding
      • Spoken English
      • Stock Market
        • Share Market Today News
        • Share Market Analysis
      • Digital Marketing
      • Accounting Course
      • SAP
      • OET
      • German
      • IELTS
      • Quantity Survey
      • MEP
      • Structural Design
      • Montessori
      • Yoga Teaching
      • Oil and Gas
    • Courses
      • Data Science Course
        • Data Science Malayalam
        • Data Science Course in Tamil
        • Data Science Course in Telugu
        • Data Science Training in Kochi
        • Data Science Training in Trivandrum
        • Data Science Course in Calicut
        • Data Science Training in Thrissur
      • Data Analytics Course
        • Data Analytics Course in Malayalam
        • Data Analytics Course in Tamil
        • Data Analytics Course in Telugu
      • Technical Upskilling
        • Quantity Surveying Course
        • Structural Design Course
        • BIM Course in Kerala
        • MEP Course
        • Embedded System Course
        • MEP Quantity Surveying Course
        • MEP Course in Kochi
        • Quantity Surveyor Course in Tamil
        • Quantity Surveying Course in Telugu
        • Quantity Surveyor Course in Hyderabad
        • Quantity Surveying Course in Chennai
        • MEP Design Course in Kerala
        • HVAC Course
        • Steel Structure Design Course
        • RCC Design Course
      • Full Stack Developer Course
        • Full Stack Development Malayalam
        • Full Stack Development Hindi
        • Full Stack Development Tamil
        • Full Stack Development Telugu
        • Full Stack Development Kannada
      • Stock Market Course
        • Stock Market Course in Malayalam
        • Stock Market Course in Tamil
        • Stock Market Course in Kannada
        • Options Trading Course
      • Mutual Funds Course
      • Forex Trading Course
      • Spoken English Course
        • Spoken English Course in Malayalam
        • Spoken English Course in Hindi
        • Spoken English Course in Telugu
        • Spoken English Course in Tamil
        • Spoken English Course in Kannada
      • Python Programming Course
      • Software Testing Course
        • Software Testing Course in Malayalam
        • Software Testing Course in Tamil
        • Software Testing Course in Telugu
      • AWS Solutions Architect Associate Course
      • PwC Edge : Strategic Accounting and Finance Programme
      • Practical Accounting Course
        • Accounting Course in Malayalam
        • Accounting Course in Tamil
        • Tally Course
        • Taxation Course
        • UAE Accounting
        • GST Course
        • Zoho Books Training
        • GST Practitioner Course in Kerala
        • GCC VAT Course
      • ACCA Training Online
        • ACCA Course in Kerala
      • SAP Training Courses
        • SAP FICO Course
        • SAP MM Course
        • SAP SD Training
        • SAP FICO Course in Tamil
        • SAP MM Course in Tamil
      • HR Management Course
      • Performance Marketing Course
      • Mern Stack Developer Course
        • Full Stack Developer Course in Kochi
        • Full Stack Developer Course in Trivandrum
        • Full Stack Developer Course in Calicut
        • Full Stack Developer Course in Pune
        • Full Stack Developer Course in Bangalore
        • Full Stack Developer Course in Hyderabad
        • Full Stack Developer Course in Chennai
        • Full Stack Developer Course in Indore
        • Full Stack Developer Course in Jaipur
        • Full Stack Developer Course in Coimbatore
      • Digital Marketing Training
        • Digital Marketing Course in Kochi
        • Digital Marketing Course in Trivandrum
        • Digital Marketing Course in Calicut
        • Digital Marketing Course in Kollam
        • Digital Marketing Course in Thrissur
        • Digital Marketing Course in Kottayam
        • Digital Marketing Course in Kannur
      • Montessori Teacher Training
        • Montessori Teacher Training in Calicut
        • Montessori Teacher Training in Kochi, Ernakulam
        • Montessori Teacher Training in Trivandrum
        • Montessori Teacher Training in Kollam
        • Montessori Teacher Training in Malayalam
        • Montessori Teacher Training in Kannada
      • Other Courses
        • German Language Course
        • OET Coaching
        • DHA Course
        • MOH Exam Coaching
        • Nurses Recruitment Abroad
        • FMGE Coaching
        • ChatGPT Course
        • Forex Trading Course
        • Yoga Teacher Training Course
        • Diploma in Early Childhood Care and Education
        • Business Administration & Hospital Management Course
        • Hospital and Healthcare Administration
        • AI for Teachers Course
    • Others
      • Railway
        • RRB Technician Notification
        • RRB JE Notification
        • RRB ALP Notification
        • RRB NTPC Notification
        • RRB RPF Notification
        • RRB RPF SI Notification
        • RRB RPF Constable Notification
        • RRB Group D Notification
        • RRB RPSF SI Notification
        • RRB SSE Notification
      • SSC
        • SSC CPO Notification
        • SSC MTS Notification
        • SSC CGL Notification
        • SSC CHSL Notification
        • SSC GD Constable Notification
        • SSC Stenographer Notification
        • SSC JE Notification
        • SSC CAPF Notification
        • SSC JHT Notification
        • Delhi Police Constable Notification
        • Delhi Police SI Notification
      • GATE
      • MAT
      • KMAT
        • KMAT Kerala 2024
      • TET
        • APTET
        • CTET
        • DSSSB
        • Karnataka TET
        • Kerala TET
        • KVS
        • MPTET
        • SUPER TET
        • TNTET
        • TSTET
        • UPTET
      • UPSC
        • UPSC CAPF Notification
        • UPSC CDS Notification
        • UPSC NDA Notification
        • UPSC Civil service Notification
    • Free Learn
      • Free Courses
        • Free Coding Courses
        • Free Accounting Courses
        • Free Digital Marketing Courses
        • Engineering Upskilling Courses
        • Free Hospital Administration Courses
        • Free OET Training
        • Free SAP Courses
        • Free Teachers Training Courses
        • Free Trading Courses
      • Question Answer
      • Aptitude Questions
      • Webinars
    • Test Prep
      • Kerala PSC Coaching
        • KPSC Degree Level Exam Preparation
        • Kerala PSC 12th Level Exam Preparation
        • Kerala PSC 10th Level Exam Preparation
        • KAS Coaching
        • Kerala PSC LDC Coaching
        • Kerala PSC LD Typist Coaching
        • Kerala PSC Fireman Coaching
        • KSFE Assistant Exam Preparation
        • Secretariat Office Attendant Coaching
        • Secretariat Assistant Coaching
        • Kerala PSC SI Exam Coaching
        • Khadi Board LDC Exam Preparation
        • Devaswom Board LDC Coaching
        • University LGS Exam Preparation
        • University Assistant Exam Coaching
        • KPSC Scientific Officer Exam Coaching
        • KPSC Probation Officer Grade II
        • KPSC Food Safety Officer Coaching
        • KWA Sanitary Chemist Coaching
        • KPSC Diary Farm Instructor Exam Coaching
        • Kerala PSC KWA Lab Assistant Exam Coaching
        • Kerala PSC ICDS Supervisor Exam Coaching
        • KPSC Finger Print Searcher Coaching
        • Kerala PSC Welfare Officer Gr. II Exam Coaching
        • KPSC Assistant Dental Surgeon Coaching
      • KPSC Teaching Exams
        • HSA Exam Preparation
        • KPSC HSA Social Science Coaching
        • KPSC HSA Physical Science Coaching
        • KPSC HSA English Coaching
        • KPSC Junior Language Teacher Hindi
        • KTET Coaching
        • SET Coaching
        • LP/UP Assistant Exam Coaching
        • HSST Exam Preparation
        • HSST Commerce Exam Coaching
        • Kerala PSC Lecturer in Diet Coaching
        • KVS PGT/TGT Coaching
      • Kerala PSC Technical Exams Coaching
        • Assistant Engineer Electrical Exam Coaching
        • Assistant Engineer Electronics Coaching
        • Assistant Engineer Mechanical Coaching
        • Kerala PSC Industries Extension Officer Coaching
        • KPSC LSGD AE Exam Coaching
        • KPSC Civil Engineering Exam Coaching
        • KPSC Mechanical Engineering Exam Coaching
        • KPSC Electrical Engineering Exam Coaching
        • KPSC Electronics Engineering Exam Coaching
        • KPSC Technical Computer Science Coaching
        • KPSC Tradesman Turning Coaching
        • Kerala PSC Overseer Exam Coaching
        • KPSC Assistant Town Planner Coaching
        • Lecturer in Polytechnic Electronics Coaching
      • Teaching Exams Coaching
        • CSIR NET Exam Coaching
        • EMRS Coaching
        • CTET Exam Online Coaching
      • IELTS Training Online
      • Bank Exam Coaching Online
        • SEBI Grade A Coaching
        • IBPS SO Online Coaching
        • IBPSC PO Online Coaching
        • IBPSC Clerk Online Coaching
        • SBI PO Coaching
        • SBI Clerk Online Coaching
        • SBI Apprentice Class
        • SBI SO Online Coaching
        • RBI Grade B Coaching
        • RBI Assistant Coaching
        • CSEB Exam Coaching
        • IBPS RRB Coaching
        • IBPS RRB PO Coaching
        • Canara Bank Po Exam Coaching
        • Kerala Gramin Bank Coaching
        • Kerala Bank Exam Coaching
        • JCI Exam Coaching
        • NABARD Grade A Coaching
        • LIC AAO Coaching Online
      • UPSC Online Coaching
        • UPSC CAPF Online Coaching
      • SSC Online Coaching
        • SSC JE Online Coaching
        • SSC CGL Coaching
        • SSC CGL AAO Coaching
        • SSC CGL CBI Inspector Coaching
        • SSC CHSL Coaching
        • SSC MTS Coaching
        • SSC Stenographer Coaching
        • SSC GD Online Coaching
      • RRB Exams Coaching
        • RRB RPF Exam Coaching
        • RRB NTPC Exam Coaching
        • RRB JE Online Coaching
        • RRB JE Electronics Coaching
        • RRB ALP Exam Coaching
        • RRB Technician Exam Coaching
      • CAT Online Coaching
      • CMAT Online Coaching
      • XAT Exam Coaching
      • GATE Online Coaching
        • GATE CE Online Coaching
        • GATE ME Online Coaching
        • GATE EE Online Coaching
      • NMAT Exam Coaching
      • AAI ATC Jr Executive Coaching
      • Cochin Shipyard Executive Trainee Coaching
      • BEL Probationary Engineer Coaching
      • HPCL Junior Executive Coaching

    © 2023 Entri.app - Privacy Policy | Terms of Service

    Chat