Arrays in Java
Unlike C++, arrays are first class objects in Java. For example, in the following program, size of array is accessed using length which is a member of arr[] object.
|
// file name: Main.java
public
class
Main {
public
static
void
main(String args[]) {
int
arr[] = {
10
,
20
,
30
,
40
,
50
};
for
(
int
i=
0
; i < arr.length; i++)
{
System.out.print(
" "
+ arr[i]);
}
}
}
Output:
10 20 30 40 50
Disclaimer: This does not belong to TechCodeBit, its an article taken from the below
source and credits.
source and credits: http://www.geeksforgeeks.org
We have built the accelerating growth-oriented website for budding engineers and aspiring job holders of technology companies such as Google, Facebook, and Amazon
If you would like to study our free courses you can join us at
http://www.techcodebit.com. #techcodebit #google #microsoft #facebook #interview portal #jobplacements
#technicalguide