import com.example.datacollect.*; public class Main { public static void main(String[] args) { CrawlStrategy strategyA = new ASiteCrawlStrategyImpl(); CrawlStrategy strategyB = new BSiteCrawlStrategyImpl(); CrawlStrategy strategyC = new CSiteCrawlStrategyImpl(); CrawlStrategy strategyD = new DSiteCrawlStrategyImpl(); strategyA.crawl("http://www.example-a.com"); strategyB.crawl("http://www.example-b.com"); strategyC.crawl("http://www.example-c.com"); strategyD.crawl("http://www.example-d.com"); try { throw new NetworkException("连接超时"); } catch (CrawlException e) { System.out.println("捕获异常: " + e.getMessage()); } try { throw new ParseException("HTML格式错误"); } catch (CrawlException e) { System.out.println("捕获异常: " + e.getMessage()); } try { throw new UnsupportedSiteException("UNKNOWN"); } catch (CrawlException e) { System.out.println("捕获异常: " + e.getMessage()); } } }