Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Native Method

 
Vanitha Sugumaran
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>> Why not 2?
An inner class can be private.
Junilu
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inner classes can be private.
 
Jyotsna Umesh
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic