// short program to demonstrate the value semantics of primitive types versus // the reference semantics of object types import java.util.*; public class Semantics { public static void main(String[] args) { // value semantics int x = 3; int y = x; y = -98; System.out.println("x = " + x + ", y = " + y); // reference semantics int[] list1 = {2, 4, 6, 8}; int[] list2 = list1; list2[0] = -98; System.out.println("list1 = " + Arrays.toString(list1)); System.out.println("list2 = " + Arrays.toString(list2)); } }