0

Why does the array Length function not work?

Using the scanner function to retrieve a value from a user, when input into an array and simply querying that number from the array by using the array Length method does not work. Code is as follows : import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); int inputi = input.nextInt(); int[ ] intArr = new int[inputi]; System.out.println(intArr.Length); } } I tried the same arr.Length function in a simple manually populated array with a value of 5 and it still doesn't work. Please help. Thank you

27th Feb 2020, 7:20 AM
Stephen Jeffery
Stephen Jeffery - avatar
2 Answers
+ 2
You're awesome!!!!!!!!! Thank you so much. Such simple mistakes. Have a blessed day
27th Feb 2020, 7:27 AM
Stephen Jeffery
Stephen Jeffery - avatar