Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
warattapob-6656
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
663040 665-6
warattapob-6656
Merge requests
!1
Master
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Master
master
into
main
Overview
0
Commits
2
Pipelines
0
Changes
1
Merged
663040 665-6
requested to merge
master
into
main
7 months ago
Overview
0
Commits
2
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
f8c28916
2 commits,
7 months ago
1 file
+
30
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
ArrayExample.java
0 → 100644
+
30
−
0
Options
public
class
ArrayExample
{
public
static
void
main
(
String
[]
args
)
{
// Declare and initialize an array of integers
int
[]
numbers
=
new
int
[
5
];
// Assign values to the array elements
numbers
[
0
]
=
10
;
numbers
[
1
]
=
20
;
numbers
[
2
]
=
30
;
numbers
[
3
]
=
40
;
numbers
[
4
]
=
50
;
// Print the values of the array elements
System
.
out
.
println
(
"Array elements:"
);
for
(
int
i
=
0
;
i
<
numbers
.
length
;
i
++)
{
System
.
out
.
println
(
"Element at index "
+
i
+
": "
+
numbers
[
i
]);
}
// Alternative way to initialize and declare an array
String
[]
names
=
{
"Alice"
,
"Bob"
,
"Charlie"
,
"Diana"
};
// Print the values of the string array elements
System
.
out
.
println
(
"\nString array elements:"
);
for
(
int
i
=
0
;
i
<
names
.
length
;
i
++)
{
System
.
out
.
println
(
"Element at index "
+
i
+
": "
+
names
[
i
]);
}
}
}
\ No newline at end of file
Loading