source file name: Div5Demo.java 

import java.io.*;

class A

{

int y;

public A(int n)

{

y=n;

}

public void disp()

{

if(y%5==0)

System.out.println("given no is divisible by 5");

else

System.out.println("given no is  not divisible by 5");

}

}

class Div5Demo

{

public static void main(String as[])

{

int n;

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

try

{

DataInputStream dis=new DataInputStream(System.in);

String s=dis.readLine();

n=Integer.parseInt(s);

A ob=new A(n);

ob.disp();

}

catch(Exception e)

{

System.out.println(e);

}

}

}


output:


D:\JavaPrograms\Constructors>javac Div5Demo.java

D:\JavaPrograms\Constructors>java Div5Demo
enter value:
65
given no is divisible by 5

D:\JavaPrograms\Constructors>java Div5Demo
enter value:
42
given no is  not divisible by 5