This is probably a simple OOP question, I’m kind of new in Java, so I was wondering why objects do not have an init method, and if objects don’t then where is it used and why?
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.
In Java you have constructors to initialize the instance. It wouldn’t be a bad pattern to introduce your own init-like method for an existing instance – post-construction – if you’re creating a framework though, as there are safer ways to access members post-construction rather than during construction.