| Author |
Interface Fields
|
Naresh Chaurasia
Ranch Hand
Joined: May 18, 2005
Posts: 309
|
|
|
What is the reason of having fields as static and final in interfaces?
|
SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
|
because interface can not have implementation
|
 |
Mo Jay
Ranch Hand
Joined: Feb 16, 2009
Posts: 83
|
|
Again Naresh Chaurasia , you are supposedly already certified therefore you shouldn't be asking basic questions like these that were part of your preparation for the SCJP exam in the first place. I Also noticed in another thread that you asked another basic question regarding checked/unchecked exception, these make me wonder how did you become SCJP and what did you use as a study material if any.
|
 |
Devaka Cooray
Saloon Keeper
Joined: Jul 29, 2008
Posts: 2691
|
|
Mo Jay wrote:
SCJP 1.4
Again Naresh Chaurasia , you are supposedly already certified therefore you shouldn't be asking basic questions like these that were part of your preparation for the SCJP exam in the first place.
Cooldown I think he need to upgrade his certification to the latest version, and might need to focus on some topics like this. Anyway, anyone can ask any SCJP-related question here.
Devaka.
|
Author of ExamLab (Download) - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
|
 |
Muhammad Khojaye
Ranch Hand
Joined: Apr 12, 2009
Posts: 341
|
|
Naresh Chaurasia wrote:What is the reason of having fields as static and final in interfaces?
Also remember, interface serves as a type which means the class that implement an interface say something about what a client can do with instances of the class, which become inappropriate when you use interface only for defining constants.
|
http://muhammadkhojaye.blogspot.com/
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Muhammad Ali Khojaye wrote:
interface serves as a type which means the class that implement an interface say something about what a client can do with instances of the class, which become inappropriate when you use interface only for defining constants.
Exactly . use final class to define the constants.giving a private constructor makes sense
|
 |
 |
|
|
subject: Interface Fields
|
|
|