Java Nineth Week Study summary

Source: Internet
Author: User

Nineth Week Java Learning Summary code:

Learning content:

URL class

The URL class is an important class in the java.net package, where an instance of the URL encapsulates a uniform Resource locator, and the application that uses the URL to create the object is called the client program.
A URL object typically contains the most basic three-part information: protocol, address, resource.

Construction Method:

The URL class typically creates a URL object using the following construction method:
**public URL(String spec) throws MalformedURLException**

**public URL(String protocol, String host,String file) throws MalformedURLException**

InetAddress class

    • Address means: Domain name, IP address
    • Get host address on Internet: Use the static method of the Interaddress class Getbyname (String s), which returns the domain name and IP address of the object that contains the host address.

    • Public String gethostname () gets the domain name contained in the object
    • Gethostaddress () Gets the IP address that the object contains.
    • Get native Address: Use the static method of the Interaddress class Getlocalhost (), the returned object contains the domain name and IP address of the local machine.

Broadcast datagram:

    • The Class D address is not used to represent your location, that is, you cannot use a class D address on your network to find your computer.
    • 224.0.0.0~224.255.255.255 is a reserved address, called a Class D address.
    • Hosts that want to broadcast or receive broadcasts must be joined to the same class D address.
Code Cloud Link: HTTPS://GITEE.COM/BESTI-IS-JAVA-2018/20165213ZQH

Java Nineth Week Study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.