• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on visibility of business methods  RSS feed

 
Nicolas Stern
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a doubt about a mock exam question.

According to the core specs (4.6.5) : the business method must be public.

Now the mock exam question:
Given the following interface:


Which method of the following bean are exposed to local clients ?:
[CODE]
@Stateless
public class MyBean implements MyI {
public int m1() { return 1; }
public int m2() { return 2; }
}

The answer provided says that both methods m1() and m2() are exposed to local client.

I had thought that since client acces bean via their interface, only m1() is exposed to local clients.

I assume the answer provided with the mock exam must be correct, but I have a doubt, because the spec is clear on this point.

Thanks for any input

Nicolas
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nicolas,



Method m2() in interface MyI is public!! Remember, methods in interfaces are public by default (in fact they can only be public).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!