Handle Exceptions in Selenium with Java – Challenge 14

I have added a program below that throws an exception. Review the program, identify the exception, and share your comments or observations below. Click the “Click for Solution” button to view the explanation of the output.

package tests;

import org.testng.annotations.Test;

public class ExceptionClass {

@Test
public void testMySkills() {
    try {
        int num=10;
        int dividend=num/0;
        System.out.println("Dividend is"+dividend);
    } catch (Exception ex) {
        System.out.println("Exception occurred:"+ex);
    }
}

}

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Testingtalkslatest.com - A project by CreativeHub IT Solutions.
Contact Us At: support@testingtalkslatest.com
Our Partner websites - Classified Hub , CodesToolbox , Smart Fitness Guide , CodesToolbox , Testing Forum
Scroll to Top
0
Would love your thoughts, please comment.x
()
x