What will be the output of the following Java program code?
for(int a=1;a<=10;a++);
System.out.print (a+'') ;
a) 123..10
b) 10
c) 11
d) Compilation Error
Answers
Answered by
1
Answer:
The correct answer is option (a)
Explanation:
123..10
Hope it helps....Plz mark as brainliest
Answered by
0
Answer:
class MainClass
{
public static void main(String arg[])
{
int arr[][]={{4,3},{2,1}};
int i,j;
for(i=1;i>-1;i--)
{
for(j=1;j>-1;j--)
{
System.out.print(arr[i][j]);
}
}
}
}
Explanation:
step : 1
A 2 dimensional array is initialiized
step : 2
nested for loop is used to print values of array
step : 3
print function is used to print the value,first value is arr[1] [1] as we can see that in this 2 dimensional array value of arr[1]={2 ,1 }; that's why value of arr[1][1]= 1 similarly value of are[1] [0] = 2 ; arr[0] [1] =3 and value of arr[0] [0] = 4 ;
hence the resultant output of this program will be "1234".
Similar questions