Java Lecture 10
Java Lecture 10
Lecture 10
Arrays In Java
Arrays in Java are like a list of elements of the same type i.e. a list of
integers, a list of booleans etc.
a. Creating an Array (method 1) - with new keyword
int[] marks = new int[3];
marks[0] = 97;
marks[1] = 98;
marks[2] = 95;
Homework Problems
1. Take an array of names as input from the user and print them on the
Apna College
screen.
import java.util.*;
//input
names[i] = sc.next();
//output
Apna College
public class Arrays {
//input
numbers[i] = sc.nextInt();
min = numbers[i];
max = numbers[i];
Apna College
}
//input
numbers[i] = sc.nextInt();
isAscending = false;
Apna College
}
if(isAscending) {
} else {
Apna College