-6

I understand that String args[] inside the public static void main line, is used to store arguments from the command line.

So is it possible to print what's inside args[]?

I wrote code that prints from args[0] what I entered in the scanner.

I know I can print what's inside "a" scanner but is it possible to print what's inside "b" ?

import java.util.Scanner;

public class lesson1 {

    public static void main(String args[]){
        Scanner a = new Scanner(System.in);

        String b = args[0];

        System.out.println(a);
    }
}
CubeJockey
  • 2,209
  • 8
  • 24
  • 31
Yuvi1
  • 9
  • 7

1 Answers1

2

You can print the entire contents of args like so:

System.out.println(Arrays.toString(args));
mdnghtblue
  • 1,117
  • 8
  • 27