<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">// play with arrays of different primitive types

public class array_types {

  public static void main(String args[]) {

      // integers

      int[] i = new int[2];
      i[0] = 10;
      i[1] = -10;
      System.out.println("Integers:\t" + i[0] + " " + i[1]);

      // doubles

      double[] d = new double[2];
      d[0] = 10;
      d[1] = 0.1;
      System.out.println("Doubles:\t" + d[0] + " " +d[1]);

      // characters

      char[] c = new char[2];
      c[0] = 'H';
      c[1] = 'i';
      System.out.println("Characters:\t" + c[0] + c[1]);

      // booleans

      boolean[] b = new boolean[2];
      b[0] = false;
      b[1] = true;
      System.out.println("Booleans:\t" + b[0] + " " + b[1]);

      // strings (well, technically strings are objects
      // but you can enter strings as literals)

      String[] s = new String[2];
      s[0] = "Hello. ";
      s[1] = "How are you?";
      System.out.println("Strings:\t" + s[0] + s[1]);

  } // method main

} // class array_types

/* OUTPUT
Integers:       10 -10
Doubles:        10.0 0.1
Characters:     Hi
Booleans:       false true
Strings:        Hello. How are you?
*/
</pre></body></html>