Online Programming Server

Login

Login with facebook [?]

Facebook

Tutorial 60: CSC1130S - Lecture 9c: World Wide Web (2)

You are here: Tutorials >> Basic >> Java >> Introduction to Computing Using Java >> CSC1130S - Lecture 9c: World Wide Web (2)

Tutorial ID60
TitleCSC1130S - Lecture 9c: World Wide Web (2)

Class URL

  • Provided in the package java.net.
  • Two available constructors:
    • URL link = new URL(String address);
    • URL link = new URL(URL base, String relativePath);
  • address refers to a String object
    • e.g.URL company = new URL("http://5390.com/")
  • base refers to an initialized URL object
    • e.g.company above
  • relativePath refers to a String object
    • e.g.new URL(company, "~pffung/index.html")

Post Your Comment

Title
Message