so I am new to java and wrote this code. why it gives me error