I have a Java program in which I need to accept the command line arguments in an array as input in the main method, and then need to pass the array to a constructor of another class in the same program. I need to know how to declare the array globally and then how to pass it and take it in the constructor.
Thanks


public) to pass it in any constructor? Since you will be invoking theconstructorfrom the main method itself, you can pass the array that you get as commandline argument, to the constructor.