Computer Science, asked by fswaleha195, 1 year ago

2. What will be the output of the following code -
for(int a=1; a<5; ++a ) System.out.print("Java" + " ");​

Answers

Answered by neetesh21
10

Answer:

Java Java Java Java

Explanation:

Program will run 4 times.

When a=1,2,3,4 . But when a=5 condition( a<5) will go wrong as a must be less than 5.

So it will proceed till a=4.

That's why Java is printed 4 times.

Answered by risablion99
1

Here is your answer . Please mark as brainliest

Attachments:
Similar questions