Guest User

Untitled

a guest
Oct 1st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class Boolean {
  5.  
  6. public static void main(String[] args) {
  7. // dekralasi variabel
  8. int A, B ;
  9. boolean lb, lk, lbs, lks, sm, tsm ;
  10. //Inisialisasi Valuenya
  11. A = 100 ;
  12. B = 30 ;
  13.  
  14. // contoh operasi
  15. lb = A>B ;
  16. lk = A<B ;
  17. lbs = A>=B ;
  18. lks = A<=B ;
  19. sm = A==B ;
  20. tsm = A!=B ;
  21.  
  22. // hasil dari operasi
  23. System.out.println(A+" > "+B+" => "+lb);
  24. System.out.println(A+" < "+B+" => "+lk);
  25. System.out.println(A+" >= "+B+" => "+lbs);
  26. System.out.println(A+" <= "+B+" => "+lks);
  27. System.out.println(A+" = "+B+" => "+sm);
  28. System.out.println(A+" != "+B+" => "+tsm);
  29.  
  30. //untuk menambahkan input dari keyboard
  31. System.out.println(" Masukkan True or False = ") ;
  32. boolean input = new Scanner(System.in).nextBoolean() ;
  33. System.out.print(" Yang Anda Masukkan Adalah : ") ;
  34. System.out.println(input) ;
  35.  
  36. }
  37.  
  38. }
Add Comment
Please, Sign In to add comment