What is the difference in bytecode between public attribute and private one with simple getter/setter in Java?
What is the difference in bytecode between public attribute and private one with simple
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With public field you have:
With private + set/get:
So from the performance point of view private + set/get gives just unnecessary overhead. But it have an architecture profits and should be used by some conventions like JavaBeans.