1) Write a program to implement multidimensional array.
Click Here
2) State line number and error.
class Test2
{
public static void main( String args[] )
{
inta[] = new int[5]; //line1
int[] arr = new int[];//line2
}
}
Line 1 : Not a Statement
Line 2 : Array Dimension missing
3) State the Output
class Test5
{
public static void main( String args[] )
{
int[] arr = new int[5];
System.out.println(arr);
System.out.println(arr[0]);
}
}
Output:
4) Write a program to display array elements using for-each loop.
Click Here
Click Here
2) State line number and error.
class Test2
{
public static void main( String args[] )
{
inta[] = new int[5]; //line1
int[] arr = new int[];//line2
}
}
Line 1 : Not a Statement
Line 2 : Array Dimension missing
3) State the Output
class Test5
{
public static void main( String args[] )
{
int[] arr = new int[5];
System.out.println(arr);
System.out.println(arr[0]);
}
}
Output:
4) Write a program to display array elements using for-each loop.
Click Here