Comment utiliser l’opérateur ternaire(?)

Author:


Download

 
public class OpConditionnel
{
   public static void main(String args[])
   {
      int value = 1;
      System.out.println("J'ai " + value + " PC" + (value == 1 ? "." : "s."));
 
      value++;
      System.out.println("J'ai " + value + " PC" + (value == 1 ? "." : "s."));
   }
}

Cet article Comment utiliser l’opérateur ternaire(?) est apparu en premier sur .