array initialization example source code
//array initialization example source code
package arrays;
public class ArrayInitilization {
public static void main(String[] args) {
char[] ch={'j','a','v','a'};
String [] s= {"sun","java"};
int [] a=new int[3];
a[0]=10;
a[2]=20;
a[3]='a'; // a implicit pomote to int
a[4]=50; // error
}
}
0 comments:
Post a Comment