What is the output of this program?
class Array10
{
public static void main(String[] args)
{
int[]x=new int[5];
x[0]=10;
x[1]=20;
x[2]=30;
for(int a:x)
System.out.println(a);
}
}
/*
Output:- 10 20 30 0 0
Explanation:- If we are not satisfied with default values then we can override these values
with customized values. If we don't override then default values still remains.
*/
{
public static void main(String[] args)
{
int[]x=new int[5];
x[0]=10;
x[1]=20;
x[2]=30;
for(int a:x)
System.out.println(a);
}
}
/*
Output:- 10 20 30 0 0
Explanation:- If we are not satisfied with default values then we can override these values
with customized values. If we don't override then default values still remains.
*/
0 comments: