Fastpages Primitives Notes/Learning Captured

  • set of data types
  • in CSA exam; consist of int, boolean, double
    • int; integer
    • boolean; true/false
    • double; stores floating pt numbers
  • includes variables
public class DefinePrimitives {
    public static void main(String[] args) {
      int anInt = 100;
      double aDouble = 89.9;
      boolean aBoolean = true;

      // not primitives but essential
      String aString = "Hello, World!";   // wrapper class shortcut assignment
      String aStringFormal = new String("Greetings, World!");
  
      System.out.println("anInt: " + anInt);
      System.out.println("aDouble: " + aDouble);
      System.out.println("aBoolean: " + aBoolean);
      System.out.println("aString: " + aString);
      System.out.println("aStringFormal: " + aStringFormal);
    }
  }
  DefinePrimitives.main(null)
anInt: 100
aDouble: 89.9
aBoolean: true
aString: Hello, World!
aStringFormal: Greetings, World!