File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface Ques Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Interface Ques" Watch "Interface Ques" New topic
Author

Interface Ques

Ishaan Mohan
Ranch Hand

Joined: Jan 20, 2001
Posts: 115
Which of these statements about Interfaces are true ?
a) Interfaces are abstract by default.
b) An Interfaces can have static members.
c) All methods in an interfaces are abstract although you need
not declare them to be so.
d) Fields of an Interface may be declared as transient or
volatile but not Synchronized.
e) Interfaces cannot be final.
Answer given are a and c.
My question is why not e ?
Interfaces are abstract so they cannot be final.
Pls. clarify this.
huiying li
Ranch Hand

Joined: Feb 12, 2001
Posts: 68

b) An Interfaces can have static members.
e) Interfaces cannot be final.
I think the answer should be a, b, c, e.
b) is right because interfaces can define constance and they are public static and final
e) is correct because interfaces are abstract and therefore can not be final Mugal's book page 111, states this explicitly.

SCJP
Hima Mangal
Ranch Hand

Joined: Feb 25, 2001
Posts: 82
i think a,b,c are right..
interfaces cannot be final becasue that will mean that one can't extend an interface under any circumstances , which is not possible.. and not mentioned anywhere in JLS.. i guess..
------------------
Hima


Hima<BR>Sun Certified Java Programmer
Rana Thakur
Greenhorn

Joined: Feb 26, 2001
Posts: 26
For the choice b, if it is member variables in an interface then they are public, static and final, even if not stated. However, interface cannot have static member functions.
Ishaan Mohan
Ranch Hand

Joined: Jan 20, 2001
Posts: 115
Thanks everyone.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Interface Ques
 
Similar Threads
will it possible to definefianl abstarct class and interfaces?
Q. interface definitions
declarations and modifiers
classes cannot be marked as protected?????
Some basic questions - part 2