source file name:  reversenocmd.java

class reversenocmd

{

void reverse(int no)

{

int d;

long revno=0;

while(no>0)

{

d=no%10;

revno=revno*10+d;

no=no/10;

}

System.out.println("reverse number: "+revno);

}

public static void main(String args[])

{

int n=Integer.parseInt(args[0]);

 reversenocmd ob=new reversenocmd();

ob.reverse(n);

}

}


output:

D:\JavaPrograms\CmdPrograms>javac reversenocmd.java

D:\JavaPrograms\CmdPrograms>java reversenocmd 12345

reverse number: 54321

D:\JavaPrograms\CmdPrograms>java reversenocmd 12321

reverse number: 12321

D:\JavaPrograms\CmdPrograms>java reversenocmd 65328

reverse number: 82356