Comment utiliser l’opérateur ternaire(?)

Author:


{filelink=4615}


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."));
   }
}

Leave a Reply

Your email address will not be published. Required fields are marked *