Basic Datatypes
- What is the output of below code snippet?
class Z
{
}
enum Enums extends Z
{
DCB, FEG, HIJ, LMN;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Enum types cannot extend class.
- What is the output of below code snippet?
enum Levels
{
private BOTTOM,
public MEDIUM,
protected TOP;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Enum cannot have any modifiers. They are public, static and final by default.
- Which of the below data type doesn’t support overloaded methods for +,-,* and /?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
int, float, double provide overloaded methods for +,-,* and /. BigDecimal does not provide these overloaded methods.
- Which of the following is the advantage of BigDecimal over double?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
BigDecimal has unnatural syntax, needs more memory and creates great amount of garbage. But it has high precision which is useful for some calculations like money.
- Are enums are type-safe?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Enums are type-safe as they have own name-space.