import java.*;
class EvenOdd
{
public static void main(String[] args)
{
int a,i;
if(args.length>0)
{
for(i=0;i<args.length;i++)
{
try
{
a=Integer.parseInt(args[i]);
}
catch(NumberFormatException nfe)
{
System.out.print("\n\nThis is not a valid Integer,\nSo considering it as 0 \n\n");
a=0;
}
if(a%2==0)
{
System.out.print("\n"+a+" -------> Even\n");
}
else
{
System.out.print("\n"+a+" -------> Odd\n");
}
}
}
}
}
class EvenOdd
{
public static void main(String[] args)
{
int a,i;
if(args.length>0)
{
for(i=0;i<args.length;i++)
{
try
{
a=Integer.parseInt(args[i]);
}
catch(NumberFormatException nfe)
{
System.out.print("\n\nThis is not a valid Integer,\nSo considering it as 0 \n\n");
a=0;
}
if(a%2==0)
{
System.out.print("\n"+a+" -------> Even\n");
}
else
{
System.out.print("\n"+a+" -------> Odd\n");
}
}
}
}
}
class MyClass {
ReplyDeletestatic int odev(int a)
throws IllegalArgumentException{
if((a % 2!=0)){
throw new IllegalArgumentException("This no should be even no");
}
else{
return a + 0;
}
}
}
class OddEven{
public static void main(String[]args){
try
{
int x =MyClass.odev(10);
System.out.println("x " + "is even");
}
catch (IllegalArgumentException e){
System.out.println(e.getMessage());
}
}
}