Java code for a basic program