Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.IOException;
import java.net.URL;

public class Main {

    public static void main(String[] args) {
        try {
            URL url = new URL("http://www.java2s.com/query?abc=def");
            System.out.println("URL is " + url.toString());
            System.out.println("authority is " + url.getAuthority());
            System.out.println("default port is " + url.getDefaultPort());
            System.out.println("query is " + url.getQuery());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}