B is correct. Tested. A doesn't compile because method class can't be public, C doesn't compile because you can't reference non-static members from static context and D doesn't compile because move method must be public.
Answer is D, tested
class Vehicle{
int id;
public void start(){
// compile error public class Engine{ int eNo = id;}
}
}
class Computer{
// compile error private Card card = new SoundCard();
private abstract class Card{}
// compile error private class SoundCard extends Card{}
}
class Block{
int bno;
static class Counter{
int locator;
//compile error Counter(){ locator = bno;}
}
}
class Product{
interface Moveable{void move();}
Moveable m = new Moveable() {
@Override
public void move() {
}
};
}
upvoted 4 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.
richotaru
Highly Voted 3 years, 4 months agosteefaand
Most Recent 5 months, 4 weeks agoOhayou
2 years, 4 months agoWilsonKKerll
2 years, 4 months agoSamriddji
2 years, 8 months agolaura_lu93
3 years, 5 months agopul26
3 years, 7 months ago