/**
 * Copyright (C) 2024 by Martin Robillard. 
 * See https://codesample.info/about.html
 */
package essentials;

/**
 * Java is a statically-typed language. This means that each variable must have 
 * a type explicitly specified in the source code. Java supports two different kinds
 * of types: primitive types and reference types.
 */
public class Types
{
	public static void main(String[] args)
	{
		int day = 25;
		Integer month = Integer.valueOf(3); // March
Integer year = 2024;
String[] months = {"January", "February", "March", "April", "May"}; // ...
System.out.println(day + " " + months[month-1] + " " + year);
System.out.println(String.join(" ", Integer.toString(day),
months[month-1], Integer.toString(year)));
// Copying the value of a primitive type copies the primitive value int dayCopy = day; day++; System.out.println("dayCopy=" + dayCopy);
// Copying the value of a reference type creates an alias to the same object String[] monthsAlias = months; months[0] = "JANUARY"; System.out.println("monthsAlias[0]=" + monthsAlias[0]);
} }