How to do it…

Follow these steps:

  1. Add the following imports to the project:
import java.io.File;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
  1. Add the following try block to the main method:
try {
String htmlText = Jsoup.connect("https://en.wikipedia.org/wiki/Language").get().html();
System.out.println(htmlText.substring(0, 100));
System.out.println();
} catch (IOException e) {
// Handle exceptions
}
  1. Execute the program. You will get the following output:
<!doctype html>
<html class="client-nojs" lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.191.118