Program to show the name date and expiration date of entered url using java
import
java.util.Scanner;
import
java.util.*;
import
java.net.*;
public class
programno3
{
URL z;
URLConnection y;
String w;
programno3()
{
try
{
System.out.println("Enter The
URL:-");
Scanner rv=new Scanner(System.in);
w=rv.nextLine();
z=new URL(w);
y=z.openConnection();
long a=y.getDate();
long b=y.getExpiration();
long c=y.getLastModified();
System.out.println("Date"+a);
System.out.println("Expiration"+b);
System.out.println("modified"+c);
}
catch(Exception e)
{
System.out.println("error");
System.exit(0);
}
}
public static void main(String...s)
{
new
programno3();
}
}
0 Comments