What is the result?

Given the Greetings.properties file, containing:

What is the result?

Given the Greetings.properties file, containing:

What is the result?

A.
Compilation fails

B.
HELLO_MSG

C.
GOODGYE_NSG

D.
Hello, everyone!

E.
Goodbye everyone!

Explanation:

The code will not compile.
The problem is the following line:
System.out.println(resource.getObject(1));
In particular getObject(1) throws the following error:
Exception in thread “main” java.lang.RuntimeException: Uncompilable source code – Erroneous
sym type:
<any>.loadResourceBundle
Note:getObject(String key) !!! String keyGets an object for the given key from this resource bundle
or one of its parents.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


jalex

jalex

Answer is A, because getObject() receives String instead of int