Java-MoreDetails Lecture
Java-MoreDetails Lecture
More Details
Array
void modifyArray(double d[ ]) {
d[0] = 1.1; // visible to the caller
}
void modifyArray(double d[ ]) {
d = new double [10];
d[0] = 1.1; // not visible to the caller
}
Example – 2 Row 1
int b[ ][ ] = { { 1, 2 }, { 3, 4, 5 } };
b[0][2] = 8; //will throw an
exception
b[0][2] does not exist
In both cases
b.length equals 2
b[0].length equals 2
b[1].length equals 3 Prepared By - Rifat Shahriyar 17
Command Line Arguments
3
Hello
java CommandLineTest Hello 2 You
2
You
Prepared By - Rifat Shahriyar 20
For-Each