Array declaration and print in java language.

public class array {

    public static void main(String[] args) {

        int[] marks =new int[3];

        marks[0]=95; //physics

        marks[1]=98; // math

        marks[2]=97; // chemistry

        System.out.println(marks[0]);

        System.out.println(marks[1]);

        System.out.println(marks[2]);

    }

}

● Output->

95

98

97

Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.