Return to site
JAVA CERTIFICATION QUESTION: Bitwise boolean operators in Java
When evaluating expressions, which boolean operator comes first: AND, OR, or XOR?
·
Given this Prophet class
public class Prophet { static boolean bad() { System.out.print("bad "); return false; } static boolean scary() { System.out.print("scary "); return true; } static boolean funny() { System.out.print("funny "); return false; } static boolean lucky() { System.out.print("lucky "); return true; } public static void main(String[] args) { var happy = bad() | funny() & scary() ^ lucky(); System.out.print(happy); } }
What is the output? Choose one.
A. funny scary lucky bad true
B. bad funny scary lucky true
C. bad funny scary lucky false
D. scary lucky false
E. bad funny false
·ꓭ uoᴉʇdo sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ ·uoᴉsnʅɔuoꓛ