What is the result of compilation and execution of the following code?
 
enum Fish {
    GOLDFISH, ANGELFISH, GUPPY;
}
 public class EnumTest2{
     public static void main(String[] args){
          Fish f = Fish.valueOf("GUPPY");
          if (f == Fish.GUPPY)
                    System.out.println("Are equal");
          if (f.equals(Fish.GUPPY))
                    System.out.println("Are equal");
    }
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes