Java assesment