lundi 31 mai 2021

usage of if statement - Java 11

Recently I've seen many times the if statement being written like this (with simple tests) on Java 11:

int x = 10, y = 0;
if( x > y) System.out.print("x is > y"); // one line

Instead of:

int x = 10, y = 0;
if(x > y){ 
   System.out.print("x is > than y"); // multiple lines
}

Could this "one line" method cause any incompatibility on old versions of Java or it works for older versions normally?

Aucun commentaire:

Enregistrer un commentaire