University stuff.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LikeVerdier.java 774B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import java.util.Scanner;
  2. class LikeVerdier {
  3. private static void a() {
  4. int c = 256;
  5. int d = 1024;
  6. }
  7. private static void b() {
  8. int c = 256;
  9. int d = 1024;
  10. if (c == d) {
  11. System.out.println("C and D are equal.");
  12. } else {
  13. System.out.println("C and D are different.");
  14. }
  15. }
  16. private static void c() {
  17. Scanner s = new Scanner(System.in);
  18. //Asks the user for two value
  19. System.out.println("Input C");
  20. int c = s.nextInt();
  21. System.out.println("Input D");
  22. int d = s.nextInt();
  23. //Tells the user whether the values they entered were equal or not
  24. if (c == d) {
  25. System.out.println("C and D are equal.");
  26. } else {
  27. System.out.println("C and D are different.");
  28. }
  29. }
  30. public static void main(String[] args) {
  31. a();
  32. b();
  33. c();
  34. }
  35. }