Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
52 lines (38 loc) · 1.25 KB

File metadata and controls

52 lines (38 loc) · 1.25 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.ArrayList;
import java.util.ArrayList;
public class CustomArrayList {
int size =4;
class Data {
private String name;
private int marks;
private int rollno;
private long phoneNum;
public Data(String name, int marks, int rollno, long phoneNum) {
this.name = name;
this.marks = marks;
this.rollno = rollno;
this.phoneNum = phoneNum;
}
}
public static void main(String[] args) {
int roll[] = {1,2,3,4};
int marks[] = {100,200,300,400};
String[] names = {"Kiran","Mugor","Agastya","Bala"};
long[] phones = {123456789,21111111, 12344555, 12333333};
CustomArrayList arrayList = new CustomArrayList();
arrayList.addValues(names, marks, roll, phones);
}
public void addValues(String[] names, int[] marks, int[] roll, long[] phones) {
ArrayList<Data> list = new ArrayList<>();
for (int i=0;i<size; i++) {
list.add(new Data(names[i], marks[i], roll[i], phones[i]));
}
printValues(list);
}
public void printValues(ArrayList<Data> list) {
for (int i=0; i<list.size(); i++) {
Data data = list.get(i);
System.out.println("Name => "+data.name +" Roll==> "+data.rollno +" Marks ==> "+data.marks +" Phones ==>"+data.phoneNum);
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.