Using Java and c# for the same example give a different result.
Code in Java :
public static void main(String[] args)
{
for(int i = 0; i < args.length; i++)
{
System.out.println(args[i]);
}
}
Here's is the content folder where my java and class files are located :
Folder Content
If i use this code through the CMD, it's fine :
java FileC 2 - 3
Or
java FileC 2 + 3
The result is fine :
2
-
3
or
2
+
3
If i use :
java FileC 2 * 3
The result is :
2
FileB.css
FileC.class
FileC.java
FileD.txt
FileE.eml
folderA
3
But it should be printing :
2
*
3
If i use this :
java FileC 2 "*" 3
It works fine i get :
2
*
3
As explained here, the answer said that the * sign was expanded : The issue of * in Command line argument
But when i use the same code block in c# and run it the same way i did java "myApp 2 * 3" it worked fine, no need for quotes this time, so is it really a shell/cmd interpretation ? I'm confused !