Print out the console parameters in Java

Description

The following code shows how to print out the console parameters.

Example


//  w  w  w  . j  av  a2  s .  co  m
public class Main {
  public static void main(String[] args) {
    if (args.length == 0) {
      System.out.println("No arguments");
    } else {
      System.out.println("Arguments:");
      for (int i = 0; i < args.length; i++) {
        System.out.println(args[i]);
      }
    }
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    I/O »




Binary File
Byte Array
CharSet
Checksum
Console
Create Copy Move Delete
Directory
Drive
Encode Decode
File Attribute
File Lock
File System
GZIP
Jar File
NIO Buffer
Path
Scanner
StreamTokenizer
Temporary File
Text File
Zip