nerdexam
Oracle

1Z0-805 · Question #63

Given the code fragment: / method declaration / { try { String className = "java.lang.String"; String fieldname = "somefield"; Class c = Class.forName(className); Field f = c.getField(fieldname); }…

Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #63. The question stem and answer options stay visible for context.

Exceptions and Assertions

Question

Given the code fragment:

/* method declaration */ { try { String className = "java.lang.String"; String fieldname = "somefield"; Class c = Class.forName(className); Field f = c.getField(fieldname); } catch(Exception e) {

Options

  • Apublic void getMetadata ()
  • Bpublic void getMetadat ()
  • Cpublic void getMetadata () throws Exception
  • Dpublic void getMetadata () throws NoSuchFieldException
  • Epublic void getMetadata () throws classNotFoundException
  • Fpublic void getMetadata () throws ClassNotFoundException, NoSuchFieldException.

Unlock 1Z0-805 to see the answer

You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#reflection#exception handling#checked exceptions#Class.forName
Full 1Z0-805 Practice