0
String[] args, why?
In this code class MyClass { static int sum(int val1, int val2) { return val1 + val2; } public static void main(String[ ] args) { int x = sum(2, 5); System.out.println(x); } } Why is it String[] args but not String args[]?
3 Réponses
+ 3
Tibor Santa Thanks! Got the answer, but thanks anyway for taking out the time to answer!
+ 2
Thesmallest Thanks! This cleared a couple of doubts.
+ 2
Java offers two ways to declare arrays:
typename[] variablename
typename variablename[]
Both are legit, but the usual convention is the first form.