 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to handle Assertion Error in Java?
In order to handle the assertion error, we need to declare the assertion statement in the try block and catch the assertion error in the catch block.
Let us see a program on how to handle Assertion Error in Java −
Example
public class Example {    public static void main(String[] args) throws Exception {       try {          assert args.length > 0;       }       catch (AssertionError e) {          System.out.println(e.getMessage());       }    } }  Output

Advertisements
 