In this post, we will see Exception Handling in Apex Programming Language.
Exception:
An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.
Program Code:
//Math Exception
Double result=10/0;
System.debug('Result='+result);
//DML Exception
Student__c record=new Student__c();
insert record;
//Null Pointer Exception
String str;
System.debug(str.toLowerCase());
throw new NullPointerException();
No comments:
Post a Comment