Given the code fragment:
Which code fragment invokes all callable objects in the workers set?
A)
B)
C)
D)
Which two code fragments compile?
A)
B)
C)
D)
E)
The two code fragments that compile are B and E. These are the only ones that use the correct syntax for declaring and initializing a var variable. The var keyword is a reserved type name that allows the compiler to infer the type of the variable based on the initializer expression. However, the var variable must have an initializer, and the initializer must not be null or a lambda expression. Therefore, option A is invalid because it does not have an initializer, option C is invalid because it has a null initializer, and option D is invalid because it has a lambda expression as an initializer. Option B is valid because it has a String initializer, and option E is valid because it has an int initializer.
https://docs.oracle.com/en/java/javase/17/language/local-variable-type-inference.html
Given the directory structure:
Given the definition of the Doc class:
Which two are valid definition of the wordDoc class?