This might sound very basic to some of you, but I am confused about the use of () in the below code in JAVA. The code works I just need to clear some basics
public class Main {
public static void main(String[] args) {
String message = " Hello" + " " + "!! ";
System.out.println(message.length());
int[] numbers = {2,3,4,5,6};
System.out.println(numbers.length);
}
}
Why do I have to use parenthesis in the end for when getting the length differently?
thanks for the help