1

I wrote simple program just to check something. Here is the code:

public class Test {
public static void main(String[] args){
    char sign = args[0].charAt(0);
    System.out.println(sign);
}
}

I want to run it from Windows Command Line. I do:

javac Test.java
java Test

Everything is fine till the moment when I try this code with * or & as input. Is there a way to print these signs? I guess that these characters have special function in command line, but couldn't find anything about that in Internet.

boratocielli
  • 129
  • 5
  • Quote the character, so it's not interpreted by the command-line tool (cmd.exe, bash, ...): `java Test "*"` – Andreas Apr 19 '18 at 17:46

0 Answers0