Answers for "java how to do arrays"

33

how to declare array java

int intArray[];    //declaring array
intArray = new int[20];  // allocating memory to array
//OR
int[] intArray = new int[20]; // combining both statements in one
Posted by: Guest on February-21-2020
0

how to use arrays java

// How to use arrays 
// Julian
 public static void main(String[] args)
   {
   // Initialize array
      int[] arrNum = {25, 23, 15, 20, 24};
   // Recorrerlo
      for(int a = 0; a < arrNum.length; a++)
      {
         System.out.println(arrNum[a]);
      }
   }
Posted by: Guest on January-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language