source file name: LeapDemo.java 

import java.io.*;

class A

{

int y;

public A(int n)

{

y=n;

}

public void leapdisp()

{

if(y%4==0)

System.out.println("given year number is Leap no");

else

System.out.println("given year number is not Leap no");

}

}

class LeapDemo

{

public static void main(String as[])

{

int n=1;

System.out.println("enter value: ");

try{

DataInputStream dis=new DataInputStream(System.in);

String s=dis.readLine();

n=Integer.parseInt(s);

}

catch(Exception e)

{

System.out.println(e);

}

A ob=new A(n);

ob.leapdisp();

}

}


Output:

D:\JavaPrograms\Constructors>javac LeapDemo.java

D:\JavaPrograms\Constructors>java  LeapDemo

enter value:

2010

given year number is not Leap no