This website includes Education Information like a programming language, job interview question, general knowledge.mathematics

Education log

PageNavi Results No.

Ads

Thursday, April 22, 2021

java array programs

 java array programs


introduction java array:


In this lesson, we will learn to work with similar members in Java. We will learn how to advertise, start, and access filters with the help of examples.


Same members are a collection of similar types of data.


For example, if we want to save the names of 100 people then we can create a list of string types that can store 100 words.



This section includes examples of the Java program in Arrays. All program examples include program description, Java code and program release. All examples are integrated and tested in the Windows system. These examples can be simple Java programs or advanced Java programs. Therefore, they are suitable for any user (dummies, beginners or advanced users).




String[] array = new String[100];


Example java array programs:

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]);

 }

}




No comments:

Post a Comment