0
Java is this valid?
is j & k is valid,this (if statement) will valid? if(j < k /2)
6 odpowiedzi
+ 3
Yes that is a valid syntax
public class Program
{
public static void main(String[] args) {
int j = 7;
int k = 10;
if(j<k/2)
System.out.println("yes");
else
System.out.println("no");
}
}
+ 3
Yes my code example asigns value to variables j and k
int j = 7;
int k = 10;
then it compares these two variables using the if statement and the comparison we are asking is, is j less than k/2
if(j<k/2)
If the answer is yes then the code outputs yes
else the code outputs no
+ 1
I do not understand if you can link this to some code, or explain a little more as to what you want i may be able to help
0
[A^dr3w] how it work ?
7 smaller than 10, 7 divide by 2?
0
[A^dr3w] no i mean the code example you wrote,can u explain to me how it work when run the program
0
[A^dr3w] Oh ! im so foolish ,i keep thinking that (j<k) true,j/2
my brain stuck,sorry