The example is to show how to handle exceptions without catch blocks in Java.
Source Code
package com.beginner.examples;
import java.net.MalformedURLException;
import java.net.URL;
public class HandleExceptionExample {
public static void main(String[] args) throws MalformedURLException{
URL url = new URL("https://www.yahoo.com/");
System.out.println(url);
}
}
Output:
https://www.yahoo.com/
References
Imported packages in Java documentation: