Javatpoint Logo
Javatpoint Logo

Jsoup Example: print links of an URL

In this example, we will print the total links of an URL. To do so, we are going to call select() method of Document class that returns the reference of Elements. The Elements class have elements that can be traversed by for-each loop. The Element class provides attr() and text() methods to return link and text of the link.

Output:

link : http://www.javatpoint.com/contribute-us
text : Contribute Us

link : http://www.javatpoint.com/asknewquestion.jsp
text : Ask Question

link : http://www.javatpoint.com/login.jsp
text : login

.....





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA