File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes on interfaces.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "on interfaces.." Watch "on interfaces.." New topic

on interfaces..


Joined: Sep 14, 2000
Posts: 28
Hi everybody..
I have started preparing for SCJP2 right earnestly.
could somebody confirm these?
in an interface:
1. Member methods are implicitly public and abstract.
2. Member methods cannot be
static,native,private,protected,final,or synchronized.
3. Fields in an interface cannot be private or protected.
4. A class or a field declared in an interface is implicitly
static and public.
am I right?
anything that I missed out in this?
Thanks for your help.

Mapraputa Is
Leverager of our synergies

Joined: Aug 26, 2000
Posts: 10065
Take a look at
(But this is a beta-version, so if you find any mistakes, please, inform me... )

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Serge Plourde
Ranch Hand

Joined: Jun 23, 2000
Posts: 140
Hi Ramani,
I'll try my best to answer you.
From the JLS (Java Language Specification):
All interface members are implicitly public.
... Every field (constant) declaration in the body of an interface is implicitly public, static, and final.
... Every method declaration in the body of an interface is implicitly abstract, so its body is always represented by a semicolon, not a block.
...Every method declaration in hte body of an interface is implicitly public... Note that a method delcared in an interface must not be declared static... because static methods cannot be abstract... it can not be native or synchronized.. it can not be declared final.
Looks like you are all right!

Joined: Sep 14, 2000
Posts: 28
thanks a lot, Mapraputa and Serge ..
Mapraputa, the link you gave is useful.
Let me check out whether they are all correct..I like to learn from my own simple codes!
thanks for confirming ,Serge..
Ranch Hand

Joined: Sep 12, 2000
Posts: 63
I was going through the chart for modifiers that you had created. For interface variables, shouln't the static column have 'D' instead of '+', since all interface variables are static, public and final by default?
Pl. let me know if I'm wrong.
I agree. Here's the link:
subject: on interfaces..
It's not a secret anymore!