```

import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class ExtractLinks {
  public static void main(String[] args) {
    try {
      // Connect to the website
      Document document = Jsoup.connect("https://www.example.com").get();

      // Select all the links from the page
      Elements links = document.select("a[href]");

      // Iterate through the links and send a request to each link
      for (Element link : links) {
        String url = link.attr("abs:href");
        try {
          Document linkedDocument = Jsoup.connect(url).get();
          // Store the linkedDocument in the document of the previous link
          document.append(linkedDocument.toString());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      
      // Print the final document with all the linked content
      System.out.println(document.toString());
      
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}
```
```

import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class ExtractLinks {
  public static void main(String[] args) {
    try {
      // Connect to the website
      Document document = Jsoup.connect("https://www.example.com").get();

      // Select all the links from the page
      Elements links = document.select("a[href]");

      // Iterate through the links and send a request to each link
      for (Element link : links) {
        String url = link.attr("abs:href");
        try {
          Document linkedDocument = Jsoup.connect(url).get();
          // Store the linkedDocument in the document of the previous link
          document.append(linkedDocument.toString());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      
      // Print the final document with all the linked content
      System.out.println(document.toString());
      
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}
```