<code class="language-java">package program_basics; public class Condition_statement { public static void main(String[] args) { // TODO Auto-generated method stub //------------------------------------------------- //if only /* int i=25; int j=50; if (i<j) System.out.println("i is lesser"); */ //----------------------------------------------- //if else only /* int i=25; int j=50; if (i>j) { System.out.println("i is greater"); } else { System.out.println("i is lesser"); } */ //---------------------------------------------------- //else if only /* int i=35; int j=50; if (i>j) { System.out.println("i is greater"); } else if(j<i) { System.out.println("j is lesser"); } else { System.out.println("i and j are equal"); } */ } }</code>
Atas ialah kandungan terperinci Contoh untuk penyataan keadaan, jika, jika lagi, jika. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!