Hello,
If I use in only one class e.g. int x = 0; better make private int x = 0; ? Or this doesn't matter?
Thanks,
Bencratus
Private variables!?
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
- Bencratus
- Posts: 51
- Joined: Wed Jan 07, 2015 11:38 pm
- Contact:
Private variables!?
Last edited by Bencratus on Sat Feb 21, 2015 8:26 pm, edited 1 time in total.
-
- Posts: 66
- Joined: Tue Dec 24, 2013 1:30 am
Re: Private variables!?
public modifier—the field is accessible from all classes.
private modifier—the field is accessible only within its own class.
http://docs.oracle.com/javase/tutorial/ ... ables.html
private modifier—the field is accessible only within its own class.
http://docs.oracle.com/javase/tutorial/ ... ables.html
So you want a L2J Server? Check out my guide viewtopic.php?f=81&t=30556&p=182721#p182721
- Bencratus
- Posts: 51
- Joined: Wed Jan 07, 2015 11:38 pm
- Contact:
Re: Private variables!?
Seems you didn't read everything or you don't understand. I don't even talked about public variable, but you posted what you found on google.canislupus wrote:public modifier—the field is accessible from all classes.
private modifier—the field is accessible only within its own class.
http://docs.oracle.com/javase/tutorial/ ... ables.html
Nevermind
- Zoey76
- L2j Inner Circle
- Posts: 7005
- Joined: Tue Aug 11, 2009 3:36 am
Re: Private variables!?
How is this relevant to High Five support?
Our standards say that we should use the smallest scope for the variable.
So private is better than default (without any keyword).
Our standards say that we should use the smallest scope for the variable.
So private is better than default (without any keyword).
Powered by Eclipse 4.30 | Eclipse Temurin 21 | MariaDB 11.3.2 | L2J Server 2.6.3.0 - High Five
Join our Discord!
Join our Discord!
- Bencratus
- Posts: 51
- Joined: Wed Jan 07, 2015 11:38 pm
- Contact:
Re: Private variables!?
Sorry for wrong place...Zoey76 wrote:How is this relevant to High Five support?
Our standards say that we should use the smallest scope for the variable.
So private is better than default (without any keyword).
Thanks, I will change now all to private
-
- Posts: 66
- Joined: Tue Dec 24, 2013 1:30 am
Re: Private variables!?
Hi,
Why isn't it relevant? public would be the opposite of private am i right?
Why isn't it relevant? public would be the opposite of private am i right?
Hey ! The intention is what truly matters!Bencratus wrote:Seems you didn't read everything or you don't understand. I don't even talked about public variable, but you posted what you found on google.canislupus wrote:public modifier—the field is accessible from all classes.
private modifier—the field is accessible only within its own class.
http://docs.oracle.com/javase/tutorial/ ... ables.html
Nevermind
So you want a L2J Server? Check out my guide viewtopic.php?f=81&t=30556&p=182721#p182721
- Zoey76
- L2j Inner Circle
- Posts: 7005
- Joined: Tue Aug 11, 2009 3:36 am
Re: Private variables!?
It's not relevant to High Five support, is a general coding question.canislupus wrote:Why isn't it relevant?
Powered by Eclipse 4.30 | Eclipse Temurin 21 | MariaDB 11.3.2 | L2J Server 2.6.3.0 - High Five
Join our Discord!
Join our Discord!
-
- Posts: 66
- Joined: Tue Dec 24, 2013 1:30 am
Re: Private variables!?
Oh i meant about my reply, since he didn't like it.
If it doesn't belong to the section then you must be right
If it doesn't belong to the section then you must be right
So you want a L2J Server? Check out my guide viewtopic.php?f=81&t=30556&p=182721#p182721