Q. What is the output of the below Java program with Enums?
Code:
enum Bus
{
DIESEL, ELECTRIC, HYBRID
int mileage = 10;
}
public class EnumTest2
{
public static void main(String[] args)
{
Bus bus = Bus.ELECTRIC;
System.out.println(bus + ", " + bus.mileage);
}
}
β
Correct Answer: (D)
Compiler error