728x90 AdSpace

Latest Article

Java Array Declaration Initialization Example Code Program




Java Arrays Programming Examples   How to fill  and initialize string array integer array float array  Java String Array Example Java  array initialization syntax  Java  Char Array Declaration & Initialization


Declaration

int[] myArray = new int[15];
int myArray[] = new int[25];

int[] intArray = {3, 4, 2, 10, 7};
char[] charArray[] = {‘w’, ‘d’, ‘e’};
string[] stringArray[] = {"abc", "xyz", "wyz"};


Separating declaration

int[] myArray;
 . . .
 myArray = new int[25];



int[] firstArray;
firstArray = new int[3];

for(int i = 0; i < firstArray.length; i++){
  firstArray[i] = i;
 }

 System.out.println( "firstArray contents" );

 for(int i = 0; i < firstArray.length; i++) {
  System.out.print(firstArray[i] + " " );
 }
no image
  • Title : Java Array Declaration Initialization Example Code Program
  • Posted by :
  • Date : 01:12
  • Labels :





  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Top