A beginner’s error (args[0]) [duplicate]

I started to read a book on java, and there the author showed this program. But I get errors in the line with args[0]. The author writes that this line has to read string. Is it true? The error:

accessing the $args array in powershell

Try this instead: Note that it is $args and not $arg. Also when you use a PowerShell variable in a string, PowerShell only substitutes the variable’s value. You can’t directly use an expression like $args[0]. However, you can put the expression within a $() sub-expression group inside a double-