+ 1
Why we need to declare arrays before printing or returning from a method
3 Answers
+ 2
Because Java always has to know the type of the variable even when you print it as it has to use the toString method for printing it
+ 1
@WkutaBenBaruch in the above code when we print the array without keywords new int[] it is not working and trowing an error (Syntax error, insert "VariableDeclarators" to complete LocalVariableDeclaration) why is this ?
0
What do you mean by declaring?
Giving a data type?