rajamit872

Printing the string reverse through command line argument

Aug 23rd, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. //concept to print the reverse
  2. //string through command line argument
  3.  
  4. class PrintReverse{
  5. public static void main(String args[]){
  6. int num=0;
  7. System.out.println("Entered Sentence is::");
  8. for(int i=0;i<args.length;i++)
  9. {
  10. System.out.print(args[i] + " ");
  11. num++;
  12. }
  13. System.out.println("Reverse order of Entered sentence is ::");
  14. for(int j=num-1;j>=0;j--)
  15. {
  16. System.out.print(args[j] + " " );
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment