FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Data-Structures-Java/ds/OneDArray.java at master · davidjurado/Data-Structures-Java · GitHub
davidjurado
/
Data-Structures-Java
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Data-Structures-Java
/
ds
/
OneDArray.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (34 loc) · 969 Bytes
Breadcrumbs
Data-Structures-Java
/
ds
/
OneDArray.java
Copy path
File metadata and controls
40 lines (34 loc) · 969 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
30
31
32
33
34
35
36
37
38
39
40
package
com
.
ds
;
import
java
.
util
.
Arrays
;
public
class
OneDArray
{
public
static
void
main
(
String
[]
args
) {
// TODO Auto-generated method stub
int
[]
numbers
=
new
int
[
5
];
numbers
[
0
]=
20
;
numbers
[
1
]=
5
;
numbers
[
2
]=
10
;
numbers
[
3
]=
6
;
numbers
[
4
]=
11
;
//System.out.println(numbers[0]);
for
(
int
i
=
0
;
i
<
numbers
.
length
;
i
++) {
System
.
out
.
println
(
numbers
[
i
]);
}
//Array of objects
Student
[]
students
=
new
Student
[
4
];
students
[
0
]=
new
Student
(
"Hussain"
,
16
);
students
[
1
]=
new
Student
(
"Jena"
,
2
);
students
[
2
]=
new
Student
(
"Laya"
,
1
);
students
[
3
]=
new
Student
(
"Waeel"
,
0
);
//System.out.println(numbers[0]);
//for (int i=0; i<students.length;i++) {
// System.out.println("Name: "+students[i].name+" Age:"+students[i].age);
//}
for
(
Student
student
:
students
) {
System
.
out
.
println
(
"Name: "
+
student
.
name
+
" Age:"
+
student
.
age
);
}
Arrays
.
sort
(
numbers
);
for
(
int
i
=
0
;
i
<
numbers
.
length
;
i
++) {
System
.
out
.
println
(
numbers
[
i
]);
}
}
}
Back
|
FazBrowse Home
|
New Git URL