Class C: The class A2 is declared with the illegal modifier private, which is not permitted for a top-level class declaration.
Class E: The class A5 is declared as both final and abstract, which is not allowed. A class can be either final or abstract, not both.
Answer is CE.
To test:
/* A */
abstract class A3 {
private static int i;
public void doStuff(){}
public A3(){}
}
/* B */
final class A1 {
public A1(){}
}
/* C */
private class A2{ // Illegal Modifier for the class A2
private static int i;
private A2(){}
}
/* D */
class A4 {
protected static final int i = 10;
private A4() {}
}
/* E */
final abstract class A5 { // The class A5 can be either final or abstract, not both
protected static int i;
void doStuff() {}
abstract void doIt();
}
The correct answer is CE:
C -> You cannot put the keyword "private" in a class, either it is public or has the default access which can be put or not.
E -> You cannot have an abstract and final class at the same time.
Answer is: C & E
You can't have a final abstract class, D is legal
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.
MPignaProTech
2 months, 3 weeks ago7df49fb
9 months, 4 weeks agodsms
1 year, 5 months agoRajeevkuamr
2 years agoRajeevkuamr
2 years agocarloswork
2 years, 2 months agoiSnover
2 years, 3 months agoshivkumarx
2 years, 4 months ago