practising some problems in java