Skip to content

Commit c4adfc6

Browse files
committed
feat: Demonstrate array length property and default toString output of arrays
🧠 Logic: - Declares and initializes integer array `B` and float array `C`. - Prints `B.length` to show how to retrieve array size. - Prints `B` and `C` directly, which outputs their reference info (not contents) due to default toString(). - Highlights the difference between printing array contents vs. reference in Java. Signed-off-by: Somesh diwan <[email protected]>
1 parent 575349c commit c4adfc6

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
public class ArrayAB1 {
22
public static void main(String[] args) {
33
int B[] = {1,2,3,4,5};
4-
54
float C[] = {1,2,3,4,5};
65

76
System.out.println(B.length);
87
System.out.println(B);
9-
108
System.out.println(C);
119
}
1210
}

0 commit comments

Comments
 (0)