Answers for "how to intialize array in java"

7

Arrays in java

// Accessing array elements using for loop
public class AccessingArrayElements
{
   public static void main(String[] args)
   {
      int[] arrNum = {25, 23, 15, 20, 24};
      for(int a = 0; a < arrNum.length; a++)
      {
         System.out.println(arrNum[a]);
      }
   }
}
Posted by: Guest on November-25-2020
2

java create array with values

//Given values must match array type
int[] myIntArray = {1, 2, 3};
Posted by: Guest on August-31-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language