C is the only correct answer, beaucse line n1 is inside the class "Messenger", it will call the local class function of the instance. So Basicalle "writeMsg();" in position n1 is a short version of "this.writeMsg();".
C is the correct answer because, a method can access another method within a class directly. writeMsg() is an instance method and not a static method.
B is incorrect because Messenger.writeMsg() implies as if writeMsg() is a static method. In order B to be correct, keyword "static" should be explicitly declared in writeMsg() method.
Se puede llamar el un método publico dentro de otro método dentro de la misma clase
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
electri
4 weeks agosupercoder
2 months, 2 weeks agoRoss_2023
3 months, 4 weeks agofalchetto
8 months, 1 week agoOlha88
9 months, 4 weeks agoyonathanmartinez
1 year, 1 month ago