Blog Detail

September 23, 2023

Java Data Types Exercises – Part 1

  • Choose the proper data type.

                    class Main {
      public static void main(String[] args) {
        "" department = "Marketing";
      }
    }
  • Choose the proper data type.

                    class Main {
      public static void main(String[] args) {
        "" birthYear = 2007;
      }
    }
  • Choose the proper data type.

                    class Main {
      public static void main(String[] args) {
        "" maxAttempts = 3;
      }
    }
  • Choose the proper data type.

                    class Main {
      public static void main(String[] args) {
        "" fileName = "log.txt";
      }
    }
  • Choose the proper data type.

                    class Main {
      public static void main(String[] args) {
        "" exchangeRate = 1.23;
      }
    }
  • Choose the proper data type.

                    class Main {
      public static void main(String[] args) {
        "" interestRate = 0.23;
      }
    }
  • Choose the proper data type.

                    class Main {
      public static void main(String[] args) {
        "" isVIP = true;
      }
    }
  • Choose the proper data type.

                    class Main {
      public static void main(String[] args) {
        "" isEmpy = false;
      }
    }
  • What is the output of this code?

                    class Main {
      public static void main(String[] args) {
        boolean isRegistered = true;
        System.out.println(isRegistered);
      }
    }
  • Java Exercises for Data Types

    • If you’ve faced difficulties with these exercises, take a look at Data Types Module on my Java course.


    You can also share ‘Java Data Types’ Exercises on your:
    X (Twitter)TelegramLinkedinFacebook – or on your favorite platform…




    Happy Coding!
    Behnam Khani