This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Native Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Native Method" Watch "Native Method" New topic
Author

Native Method

Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
1>> Can a native method have a return type?
2>> Ques. from Marcus Mock Exam 2
Which of the following statements are true?
1) Adding more classes via import statements will cause a performance overhead,
only import classes you actually use.
2) Under no circumstances can a class be defined with the private modifier
3) A inner class may under some circumstances be defined with the protected
modifier
4) An interface cannot be instantiated
The answer is 3, 4.
Why not 2?
Thanks,
Vanitha.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4782
    
    8

>> Why not 2?
An inner class can be private.
Junilu


Junilu - [How to Ask Questions] [How to Answer Questions]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Inner classes can be private.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Jyotsna Umesh
Ranch Hand

Joined: May 09, 2001
Posts: 94
hi!
second option is false becoz inner classes can be private.
Originally posted by Vanitha Sugumaran:
1>> Can a native method have a return type?
2>> Ques. from Marcus Mock Exam 2
Which of the following statements are true?
1) Adding more classes via import statements will cause a performance overhead,
only import classes you actually use.
2) Under no circumstances can a class be defined with the private modifier
3) A inner class may under some circumstances be defined with the protected
modifier
4) An interface cannot be instantiated
The answer is 3, 4.
Why not 2?
Thanks,
Vanitha.

Bin Wang
Ranch Hand

Joined: May 01, 2001
Posts: 82
1>> Can a native method have a return type?
I know native method can have void as its return type which means nothing will be returned. But it still is return type, right?
Can native method have return type other than void?
For example:
native int method();
Please help.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Bin,
Yes, native methods can have a return type other than <code>void</code>
See JLS §8.4.3.4 Native Methods
Hope that helps.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
 
subject: Native Method