I've written the following code to answer the request: Write an if statement that assigns 0 to x when y is equal to 20. My code works as I expected, but I want to ensure my logic is correct.
public class IfStatements
{
public static void main(String[] args)
{
int x, y = 20;
if(y == 20)
System.out.println("x = " + y);
}
}
Aucun commentaire:
Enregistrer un commentaire