aspose file tools*
The moose likes Beginning Java and the fly likes Command line input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Command line input" Watch "Command line input" New topic
Author

Command line input

KESAVAN RAMANUJAM
Greenhorn

Joined: Jun 26, 2000
Posts: 7

hi
Can we use command line arguments output as input to manuplicate in another set of task?
eg:
class CommandLine
{
public static void main(String args[])
{
for (int i=0;i<args.length;i++)>
System.out.println(args[i]);
}
}
when i execute this
java CommandLine 1234
output is
1234
now i want to use this output as an input to do manuplations is it possible, if so pl explain?
regards
k7
balakrishna
Greenhorn

Joined: Jun 12, 2000
Posts: 11

the command line arguements can be used as the input from the console but the point u have to remember is that the they are strings.
they have to be modified as usable form before they are used
class CommandLine
{
public static void main(String args[])
{

String s=args[0];
int i=Integer.parseInt(s);
i=i/2;
System.out.println("half of what u entered\t=\t"+i);
}
}
this requires knowledge of wraper classes.
thank u
balakrishna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Command line input
 
Similar Threads
Strange behavior of length variable
java.lang.OutOfMemoryError: Java heap space
newbie needs help with code
Input in Java, Simplest way
cvstagdiff -- how to use -kk option in ANT build.xml file