[go: up one dir, main page]

0% found this document useful (0 votes)
26 views1 page

Import Public Class Public Static Void Try

This Java code defines a WebAddress class with a main method that uses InetAddress to look up an IP address from a hostname, prints the address if found, and prints an error message if not found due to an UnknownHostException.

Uploaded by

Treymax Sikan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

Import Public Class Public Static Void Try

This Java code defines a WebAddress class with a main method that uses InetAddress to look up an IP address from a hostname, prints the address if found, and prints an error message if not found due to an UnknownHostException.

Uploaded by

Treymax Sikan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.net.

*;

public class WebAddress {

public static void main (String[] args) {


try {
InetAddress address = InetAddress.getByName("");
System.out.println(address);
} catch (UnknownHostException ex) {
System.out.println("Could not find");
}
}
}

You might also like