Quote from balaji v on October 14, 2024, 3:32 amint arr1[]= {1 ,2, 1, 4, 2, 3, 5, 4, 3, 2, 1};
int arr2[]= {arr1.length};
System.out.println(arr1.length);
System.out.println(arr2.length);
Output
11
1
Why get the different length value please explain
int arr1[]= {1 ,2, 1, 4, 2, 3, 5, 4, 3, 2, 1};
int arr2[]= {arr1.length};
System.out.println(arr1.length);
System.out.println(arr2.length);
Output
11
1
Why get the different length value please explain
Quote from Kenneth Porter on October 14, 2024, 2:35 pmarr2 has a single element, the length of arr1.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/arrays
arr2 has a single element, the length of arr1.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/arrays