Curso de Java - Aula 44 - Array Unidimensional - eXcript

#java #eXcript How to declare a one-dimensional array in Java? Array declarations follow the same structure as variable declarations; however, it's important to note that an array in Java is an object. Therefore, we cannot simply declare an array; we must create a new instance using the 'new' operator. Below is the array declaration structure: |type| [] |name|; The first part is the type that the elements of our array should have. Next, we open and close square brackets, indicating to the Java interpreter that we are declaring an array and not a variable. Finally, we must give our array a name so that we can manipulate its elements. If, for example, we wanted to declare an array containing 100 integer elements, we would do it as follows: int[] arrayInt = new int[100]; Now, we define an Array, which contains 100 elements, where each element is of type integer, and we can access the elements through the "arrayInt" reference. Java Course: http://excript.com.br/curso-de-java.html QUESTIONS? https://goo.gl/ApYFMC Java Course Playlist:    • Curso de Java   WEBSITE: http://excript.com.br/ FACEBOOK:   / excript   MY PUBLIC PROFILE: https://goo.gl/4SPRVf EMAIL: [email protected]