import java.io.*;
import java.util.*;
public class Year{
Scanner scan=new Scanner(System.in);
int year;
public void input()throws IOException{
System.out.println("Enter any Year: ");
year=scan.nextInt();
if(year<4){
do{
for(int i=1; ; i++){
System.out.println("Re-enter the year and it should be >3: ");
year=scan.nextInt();
}
}
while(year<4);
}
}
public void compute(){
if(year%4==0)
System.out.println("Year "+year+" is Leap Year.");
else
System.out.println("Year: "+year+" is not Leap Year.");
}
public static void main(String[] args)throws IOException{
Year obj=new Year();
obj.input();
obj.compute();
}
}
import java.util.*;
public class Year{
Scanner scan=new Scanner(System.in);
int year;
public void input()throws IOException{
System.out.println("Enter any Year: ");
year=scan.nextInt();
if(year<4){
do{
for(int i=1; ; i++){
System.out.println("Re-enter the year and it should be >3: ");
year=scan.nextInt();
}
}
while(year<4);
}
}
public void compute(){
if(year%4==0)
System.out.println("Year "+year+" is Leap Year.");
else
System.out.println("Year: "+year+" is not Leap Year.");
}
public static void main(String[] args)throws IOException{
Year obj=new Year();
obj.input();
obj.compute();
}
}
Comments