Computer Science, asked by harnidh, 9 months ago

Predict the output of the given code.public class Demo
{public static void main(String args[]){ for(int i=1; i<2; i++) {
System.out.println(i); } }} *
2
12
1
123​

Answers

Answered by blackandantiqual
3

Answer:

I dont know java, but considering this in python

for(int i=1; i<2; i++)

System.out.println(i);

i=1 --> i<2 --> (1)

i=2 , and since i=2 it will not print any further messages

so the answer is most likely 1

Explanation:

It may also be 12 if im wrong

Answered by lakshmilakku
0

Answer:

12

Explanation:

public

For the JRE to be able to access and use the main method, the access modifier must be set to public. Access to a method is restricted if it isn't made public.

Similar questions