Path: csiph.com!aioe.org!.POSTED.O5hsyUvK01te0L/SZurVSQ.user.gioia.aioe.org!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: Java variable access Date: Fri, 12 Apr 2019 21:51:28 -0400 Organization: Aioe.org NNTP Server Lines: 18 Message-ID: References: <109a7224-f392-46c3-bf56-7d8bf2bfb4bf@googlegroups.com> <13t97bxk9km7n$.ooqi8n8ocm7f$.dlg@40tude.net> NNTP-Posting-Host: O5hsyUvK01te0L/SZurVSQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com comp.lang.java.programmer:38913 On 4/12/2019 5:11 PM, Joerg Meier wrote: > On Fri, 12 Apr 2019 06:57:27 -0700 (PDT), Eric Douglas wrote: >> If one would need to get and set values of simple class variables, >> is it better to declare public variables or declare them private with >> getter/setter methods, or are there situations where you would do both? >> I have been declaring all variables private though sometimes creating >> the getter/setter methods just seems like unnecessary busy work if >> making them public would accomplish the same thing. > > > You are welcome. There is also @Data, which amongst a few other things adds > @Getter and @Setter to all your fields. But today wouldn't it be better to switch to Kotlin? Arne