+ 2

Why is Sololearn Java Different?

https://code.sololearn.com/cT3FpRwQU8XQ/?ref=app With this code, the 'String[ ] args' had to be there but on my pc 'String args[]' works just fine. Why?

30th Jan 2020, 12:03 AM
Caerwyn Sabin-Rees
Caerwyn Sabin-Rees - avatar
3 Answers
+ 7
Because both are correct. For example if you create an integer array you can write int[] arr = new int[10]; (more common) or int arr[] = new int[10]; Same with String[] args / String args[]. Important is that you stick to one variant. Switching between both would confuse you. If you are not familiar with arrays just ignore it at the moment and read my answer later again.
30th Jan 2020, 12:48 AM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Sololearn code playground accepts both forms.
30th Jan 2020, 3:39 AM
Sonic
Sonic - avatar
+ 1
But how Sololearn works with java is different in some other details, and doesn't support GUI
30th Jan 2020, 6:53 AM
zemiak