a) What is the output?
class Mark
public static void main(string args[])
int i=5, j=10;
if ((i<j)&&(i== 10))
System.out.print("ok");
System.out.phintln (“Not Ok");
}
}
Answers
Answered by
1
Answer:
OUTPUT :- Not Ok
Explanation:
since the first condition given is true i.e., 'i < j ' where 'i' value is '5' and 'j' value is '10' so it is true....
BUT ,;
other condition i.e., 'i==10 which is that value of variable 'i' is 10 but it is not true since value of 'i' is initialised as '5'
and operator used is "&&" which means tha if both conditions are true then the statement "ok" will be printed but if one is true and other is false then the statement is printed and the statement given under the conditions statement is printed which is "Not Ok". ( see that while writing you maintain the case of letter given )
Similar questions