Episode 3: The Code of Objects

This is the third episode in our series on the mystical Code of Objects.

Next Episode: The Classes of Life
			// The Code of Objects
			// A mysterious and ancient script that holds the secrets of the universe

			public class Universe {
				public static class Object {
					private String name;
					private int id;
					private double mass;
					private String description;

					public String toString() {
						return "Object " + name + " (" + id + ")";
					}

					public void interact(Object other) {
						// This is where the magic happens
					}
				}
			}

			public static void main() {
				Object obj = new Object("Rock", 1, 10.0, "A rock from the universe");
				System.out.println(obj.toString());
			}
		
			// The Code of Objects in Action
			// A real-world example of the Code of Objects in use

			public class Car {
				private String make;
				private String model;
				private int year;

				public Car(String make, String model, int year) {
					this.make = make;
					this.model = model;
					this.year = year;
				}

				public String toString() {
					return "Car: " + make + " " + model + " (" + year + ")";
				}
			}

			public static void main() {
				Car myCar = new Car("Toyota", "Corolla", 2015);
				System.out.println(myCar.toString());
			}