• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Exam Q

 
Karthik Subramanian
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello Friends ,
This is from Abhilash's mock exam.
Question 9.

public interface AQuestion
{
void someMethod();
}
The class which implements AQuestion
1.Should have someMethod which must necessarily be public.
2.Should have someMethod which could be "friendly" or public
3.Should have someMethod which should not throw any checked exceptions.
4.Should have someMethod which cannot be sychronized as sychronized is not in the signature of the interface
defination
The answers given are 1,3.
But my answer is 2,3.
1 is wrong, because the access modifier could be protected.
2 Though there is no keyword called friendly i assumed that he
was referring to friendly access specifier because he put
friendly word in double quotes("friendly").(What would you 0do?)
3. is right, because the super method is not throwing any
checked exceptions

Any takers,
Thanks
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Question 9.

public interface AQuestion
{
void someMethod();
}
The class which implements AQuestion
1.Should have someMethod which must necessarily be public.
2.Should have someMethod which could be "friendly" or public
3.Should have someMethod which should not throw any checked exceptions.
4.Should have someMethod which cannot be sychronized as sychronized is not in the signature of the interface
defination
The answers given are 1,3.
But my answer is 2,3.

----------------------------------------------------------
1 is wrong, because the access modifier could be protected.
1 is right because all methods in an interface are public by default so u can't override them to make protected/private/friendly
---------------------------------------------------------
2 Though there is no keyword called friendly i assumed that he
was referring to friendly access specifier because he put
friendly word in double quotes("friendly").(What would you 0do?)
2 is wrong for the same reason
3. is right, because the super method is not throwing any
checked exceptions
yes 3 is right

regards
deekasha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic