Q.– Given the code fragment:
abstract class Toy {
int price;
// line n1
}
Which three code fragments are valid at line n1?
A) public abstract int computeDiscount( );
B) public int calculatePrice ( ) {
return price;
}
C) final Toy getToy ( ) {
return new Toy( );
}
D) public void printToy( );
E) public static insertToy( ) {
/* code goes here */
}
⧪ please give your answer in a comment section.
abstract class Toy {
int price;
// line n1
}
Which three code fragments are valid at line n1?
A) public abstract int computeDiscount( );
B) public int calculatePrice ( ) {
return price;
}
C) final Toy getToy ( ) {
return new Toy( );
}
D) public void printToy( );
E) public static insertToy( ) {
/* code goes here */
}
⧪ please give your answer in a comment section.
7 Comments
Option A B D
ReplyDeleteA B D
ReplyDeletea b e
ReplyDeleteABD
ReplyDeleteA B C
ReplyDeleteABE
ReplyDeleteABD
ReplyDelete