Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Access Array Elements Java

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 :: validate data type in request body spring validation 
Java :: java unshift 
Java :: java += 
Java :: Java Overloading by changing the number of parameters 
Java :: how to extract a set of binary strings in java 
Java :: quitar letras repetidas de una palabra en java 
Java :: load list of integers from console 
Java :: how to scroll down chrome browser in selenium java 
Java :: a multi-value map, Map<K, Collection<V, supporting multiple values per key 
Java :: data base spring 
Java :: at org.apache.spark.sql.errors.QueryCompilationErrors$.failedToFindKafkaDataSourceError(QueryCompilationErrors.scala:1037) 
Java :: Change or Replace ArrayList Elements using set() function 
Java :: null pointer exception during registering user to the firebase 
Java :: break statement in Java switch...case 
Java :: hikari cp oracle jdbc configuration 
Java :: 111111000 
Java :: java domande risposta multipla 
Java :: java 001 
Java :: what is void in java 
Java :: java 8 retrieve all list from object into single list and ignore duplicates 
Java :: convert xml file to node tree with java 
Java :: Which Is Better to Configure a Spring Boot Project — Properties or YAML? 
Java :: priorityQueue peek java 
Java :: binary search tree 
Java :: java length of array 
Java :: convert long to localdatetime java 
Java :: java resto 
Java :: java how to write something on the console with scanner 
Java :: javafx initialize 
Java :: jlabel icon size 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =