Tuliskan 1 contoh kode program Java
TI
najwa373
Pertanyaan
Tuliskan 1 contoh kode program Java
1 Jawaban
-
1. Jawaban owenizedd
berikut Salah satu code program if else dalam java :
public class IfElseDemo
{
public static void main(String args[])
{
int x = 30;
if( x == 10 )
{
System.out.print("Value of X is 10");
}
else if( x == 20 )
{
System.out.print("Value of X is 20");
}
else if( x == 30 )
{
System.out.print("Value of X is 30");
}
else
{
System.out.print("This is else statement");
}
}
}