public class Library { public static void main(String[] a) { // variable x is of type int (a built-in) int x; x = 123; // variable y is of type String (a class from the standard library) String y; y = "Hi there"; // variable z is of type ''Book'' - a class that I wrote myself - yeah: // you heard that wright: I can make my own types! Book z; // but, wait .... how can I ''assign a value to a Book variable''? // my Book class has a title, an author and a pubblication year... // -> solution: I use a constructor, called using ''new'': z = new Book("The Hitchhiker's Guide to the Galaxy", "Douglas Adams", 1978); // cool :) // now I can use my own methods to deal with ''Book objects'' such as z: System.out.println("the copy of " + z.getTitle() + " is available: " + z.isAvailable()); z.lendTo("Chris"); System.out.println("the copy of " + z.getTitle() + " is available: " + z.isAvailable()); z.giveBack(); System.out.println("the copy of " + z.getTitle() + " is available: " + z.isAvailable()); } }