We should use access modifier in java…