Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.CookieStore;
import java.net.URL;

public class Main {
    public static void main(String[] args) throws Exception {
        CookieManager cm = new CookieManager();
        cm.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
        CookieHandler.setDefault(cm);

        new URL("http://google.com").openConnection().getContent();
        CookieStore cookieStore = cm.getCookieStore();

        cookieStore.removeAll();
    }
}