AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



corejava-basics: Can i use private static final?

1) For variables:

private static final string="javaconcept";

2) For methods:

Private static final void add()

my question is Can i use "private, static, final" in single method declaration or variable declaration.

Explain the above concept as early as possible.



Thanking you.

corejava x 351
basics x 170
Posted On : 2016-09-30 09:23:59.0
profile MOHAMMAD SALEEM BASHA - anyforum.in MOHAMMAD SALEEM BASHA
266150
up-rate
3
down-rate

Answers


Yes, ofcourse we can declare private static final. Declaring a method or variable as final has some reasons like Methods called from constructors should generally be declared final. If a constructor calls a non-final method, a subclass may redefine that method with surprising or undesirable results. Similarly final variable´s value can´t be changed once initialized. Rest are very common concepts why we use private or static.

Posted On : 2016-10-01 12:07:25
Satisfied : 1 Yes  0 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523187021168
Reply This Thread
up-rate
3
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in