|
char[] A; A = new char[3]; // Array of 3 character variables A[0] = 'a'; // Each array element is a char typed variable A[1] = 'b'; A[2] = 'H'; |
Result:
![]() |
char[] A = { 'a', 'b', 'H' }; // short hand System.out.println( a[0] ); // Prints: a System.out.println( a[1] ); // Prints: b System.out.println( a[2] ); // Prints: H |
|
because: both are just a (ordered) sequence of characters
|
We will discuss this fact in more details in the next webpage....