FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-programs/LearnArrayListObject.java at main · tejaspundpal/Java-programs · GitHub
tejaspundpal
/
Java-programs
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
2
Code
Issues
0
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-programs
/
LearnArrayListObject.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (24 loc) · 892 Bytes
Breadcrumbs
Java-programs
/
LearnArrayListObject.java
Copy path
File metadata and controls
29 lines (24 loc) · 892 Bytes
Raw
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
import
java
.
util
.*;
public
class
LearnArrayListObject
{
public
static
void
main
(
String
[]
args
) {
Student
s1
=
new
Student
(
111
,
"Pranav"
,
20
);
Student
s2
=
new
Student
(
112
,
"Tejas"
,
21
);
Student
s3
=
new
Student
(
113
,
"Psrp"
,
20
);
List
<
Student
>
st
=
new
ArrayList
<
Student
>();
st
.
add
(
s1
);
st
.
add
(
s2
);
st
.
add
(
s3
);
//System.out.println(st);------>it prints addresses
// Iterator itr=st.iterator();
// while(itr.hasNext()){
// Student s=(Student)itr.next();
// System.out.println(s.rollno+" "+s.name+" "+s.age);
// }
//easy method---->
for
(
Student
s
:
st
) {
System
.
out
.
println
(
s
.
rollno
+
" "
+
s
.
name
+
" "
+
s
.
age
);
}
System
.
out
.
println
(
st
);
//after using toString in student class it shows correct output
}
}
Back
|
FazBrowse Home
|
New Git URL