Program:-
public static void main(String []args){
int [] Marks = {98, 85, 34, 65 ,75};
//to calculate the length of the array we use syntax: (ArrayName.length)
System.out.println(Marks.length);
//we can also create the array of the different data types s follows.
float [] marks = {98.34f, 85.5f, 34.4f, 65.5f, 75.5f};
System.out.println(marks.length);
System.out.println(marks[4]);
String [] Name = {"Harry", "Yash", "Sumit", "Advait"};
System.out.println(Name.length);
System.out.println(Name[3]+"\n");
//displaying the element of an array in naive way.
System.out.print(Marks[0]+"\t");
System.out.print(Marks[1]+"\t");
System.out.print(Marks[2]+"\t");
System.out.print(Marks[3]+"\t");
System.out.print(Marks[4]+"\n");
//Displaying the element of an array using for loop.
for(int i = 0;i<Marks.length;i++){
System.out.print(Marks[i]+"\t");
}
System.out.println();
//Displaying the element of an array using for-each loop.
for(int element:Marks){
System.out.print(element+"\t");
}
System.out.println();
//Quick quiz : Write a java program to print the elements of an array in reverse order.
for(int i = Marks.length-1;i>=0;i--){
System.out.print(Marks[i]+"\t");
}
}
}

