Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Java Access Array Elements

class Main {
 public static void main(String[] args) {
  
   // create an array
   int[] age = {12, 4, 5, 2, 5};

   // access each array elements
   System.out.println("Accessing Elements of Array:");
   System.out.println("First Element: " + age[0]);
   System.out.println("Second Element: " + age[1]);
   System.out.println("Third Element: " + age[2]);
   System.out.println("Fourth Element: " + age[3]);
   System.out.println("Fifth Element: " + age[4]);
 }
}
Comment

How to Access Elements of an Array in Java?

// access array elements
array[index]
Comment

PREVIOUS NEXT
Code Example
Java :: what is stringbuilder used for in java 
Java :: Java Remove HashMap Elements 
Java :: java finally block 
Java :: how to remove last latter in word in java 
Java :: java stream index 
Java :: search in rotated sorted array leetcode 
Java :: binary to string java 
Java :: data structure java 
Java :: java binary exponentiation 
Java :: how to get length of 2d array java 
Java :: Example of a Do..While Loop 
Java :: static block in java 
Java :: encryption 
Java :: use custom font java 
Java :: how to compare two strings in java 
Java :: what is return method 
Java :: generics Interface in java 
Java :: creating a properties object using a file 
Java :: vim yank to clipboard 
Java :: eclipse versioning .classpath 
Java :: androi amterila inpout dialgue to get inouti diaogue 
Java :: gatewayFilters 
Java :: jkora 
Java :: how to repeat string in java 
Java :: Deque interface in Java 
Java :: java load configuration log 
Java :: hgjhghj 
Java :: How do I retrieve editors registered for a certain file extension in Eclipse? 
Java :: An exception occurred processing JSP page /Home.jsp 
Java :: spring data rest id missing 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =