Math, asked by sivakrishna6280, 3 months ago

public class Test{
public static void main(String args[]) {
try

int x = 0;
for (x=1; x<4; X++) ;
System.out.println(x);
} catch (Exception e) {}
finally {
System.out.println("Error");​

Answers

Answered by DivyanshiN
0

Answer:

Can't understand

Explaination

Answered by shreta4567
0

Output for the given code is:

4

Error

Here the 'for loop' ends doesn't have a body. Now, the for loop will run from i = 1 till i &lt; 4 and then will come out of loop with value of 'i' as 4.

Now the next step is a print statement which prints the current value of 'i' as 4.

After that the controls goes to the final statement and also prints "Error" whatever  the upper code is.

#SPJ2

Similar questions