HOTSPOT - A developer designs an interface that contains the following code: For each of the following statements, select Yes if the statement is true. Otherwise, select No. Hot Area:
It should be No,No,No.
No - you can't access Method1 from an instance of Class2, therefore no exception is thrown.
No - Class1 inherits from Class2, so the cast of an instance of Class1 into INewInterface doesn't throw an exception.
No - Class2 uses an explicit implementation of INewInterface
No, No, No. Exactly as slargollo have described.
Try noussa's code and assign the last statement to a random variable and you will see that the casting of INewInterface on class1 is a-okay.
Nice that you checked this with code, but if you assign the casting of Class1 to a random variable you will not have any compile time errors. So it is actually no no no.
zookharb is right:first question is to check if we understand the concept of:hiding method from users of the class through the implementation of explicit interface
Aaaand... you're incorrect. It should probably be:
1. NO - We cannot call the method from Class2 instance (as said above)
2. NO - because you can cast a class to its interface, e.g.:
INewInterface newInterface = (INewInterface) class1;
and it won't throw anything as the question only asks if we can cast the instance to the interface :)
3. NO - explicit implementation - also mentioned earlier.
The answer is
No, Yes, No
1)We cannot call the method from Class2 instance - NO
2) We can cast the class1 instance to interface then we can call method - YES
3) This is explicit implementation - NO
1) It depends: If the instance is created as a Class2 it is not possible to call the method Method1 (as it is an explicit implementation) It is possible to call this method only when we pass through the interface (ex: INewInterface c2 = new Class2();)
2) No: it is possible to cast Class1 into INewInterface (Class2 implements INewInterface et Class1 extends Class2)
3) No: it is an explicit implementation
The question is not clear, if I go like this:
INewInterface class2 = new Class2();
class2.Method1();
Then the first one will be yes, but if you go like this:
Class2 class2 = new Class2();
class2.Method1();
Then it won't compile because you can't access the Method1 that way, so the question is - whether INewInterface class2 = new Class2(); means class2 is an instance of Class2 in their understanding, if not then it should be No, No, No
This section is not available anymore. Please use the main Exam Page.70-483 Exam Questions
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.
slargollo
Highly Voted 5 years, 5 months agoDiegoB
4 years, 11 months agopgarq19
Highly Voted 5 years, 5 months agosscooter1010
5 years, 4 months agoVladWork
5 years, 2 months agoabelbm
5 years, 2 months agoabelbm
5 years, 2 months agosscooter1010
5 years, 4 months agoMogens
Most Recent 4 years, 5 months agoTomasRafaj
4 years, 5 months agonoussa
4 years, 5 months agoMogens
4 years, 5 months agokobegao
4 years, 8 months agonoussa
4 years, 5 months agoDunmer
4 years, 5 months agoDunmer
4 years, 5 months agoDunmer
4 years, 5 months agozookhrab
4 years, 8 months agoeliasalg
4 years, 9 months agoPanos_
4 years, 10 months agowhtvr
5 years, 3 months agopvtpeter
5 years, 5 months agojose1024
5 years, 6 months agopvtpeter
5 years, 5 months ago