MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.net.URL;
import java.net.URLConnection;
import java.util.Date;

public class MainClass {
    public static void main(String[] args) {
        try {
            URLConnection uc = new URL("http://www.demo2s.com").openConnection();
            System.out
                    .println("Will retrieve file if it's been modified since " + new Date(uc.getIfModifiedSince()));
            uc.setIfModifiedSince(System.currentTimeMillis());
            System.out
                    .println("Will retrieve file if it's been modified since " + new Date(uc.getIfModifiedSince()));
        } catch (Exception e) {
            System.err.println(e);
        }
    }
}