title: Java program to find the IP addresses of the following websites: Facebook , google , yahoo in the same try and catch
body: <p>here is my code for one website but i need to make multiple ip's in same try and catch</p>
  
  <pre><code>package javaapplication1;
  
  import java.net.InetAddress;
  import java.net.UnknownHostException;
  
  public class JavaApplication1 {
  
      public static void main(String[] args) {
           try {
              InetAddress[] addresses = InetAddress.getAllByName("google.com");
  
              for (InetAddress address : addresses) {
                  System.out.println(address);
  
  
              }
          } catch (UnknownHostException ex) {
              System.out.println("Could not find");
          }
      }
  }
  </code></pre>