doubts in java

hi.............i want to take an array of integers as input using command line arguments. how can i do it? and please tell me what are environment variables? are they related with classpath?

Replies

  • Manish Goyal
    Manish Goyal
    Basic method of passing command line argument in java is as follow

    java a1 a2 a3 .....

    Now for declaration of command line argument we use this statement ,which is must for every java program

    public static void main(String args[])

    array can be declared as shown below

    int a[]=new int[6];

    Now since command line argument are in string form you can convert it into integer form by using this

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

    For rest ,i hope you can use your programming skills. 😀
  • Morningdot Hablu
    Morningdot Hablu
    Varsha0802
    hi.............i want to take an array of integers as input using command line arguments.
    Can you post your code so that we can help you.
  • Varsha0802
    Varsha0802
    thanks..............i got my answer....................

You are reading an archived discussion.

Related Posts

I have a doubt. c does not support function overloading. but if anyway we want to use it, how can we do it?
CEans, It’s been just over a month since aj_onduty aka Ajit joined CrazyEngineers. Within such a short period of time he has impressed all with his presence all over CE....
what is an environment variable? is it related with classpath?
We have to write a report/thesis for our project in college. The College has given us a typical format for the same. It has a topic called "Literature Survey". I...
We have started quite a few threads about Learning Japanese language. We have found it really difficult telling how to pronounce the letters...online! So please see the following simple video...