aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface Fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interface Fields" Watch "Interface Fields" New topic
Author

Interface Fields

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 356
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
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. 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
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3164
    
  47

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 ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interface Fields