The class URL in the package java.net of the Java Class Library represents a Uniform Resource Locator (i.e., a web address). You can use this class to access and read the HTML that defines a...



The class URL in the package java.net of the Java Class Library represents a Uniform Resource Locator (i.e., a web address). You can use this class to access and read the HTML that defines a particular web page. For example, the following statements read and display the first line of text on the home page for the University of Rhode Island:


URL urlAddress = new URL("http://uri.edu/index.html");


InputStream inStream = urlAddress.openStream();


Scanner webReader = new Scanner(inStream);


String line = webReader.nextLine();


System.out.println(line);


When you write statements such as these, you must handle the exceptions that might be thrown. Write a program that searches the home page of your choice and displays any URLs that it finds that are enclosed in quotes. In other words, it should search for URLs of the form "http:// ...". Next, modify the program so that it searches for and lists the URLs found at the first URL found on a web page. Enhance your program as much as you can to search the web for given strings.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here