Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

07-1. What is the output of the following code: class Course l string courseName

ID: 3718765 • Letter: 0

Question

07-1. What is the output of the following code: class Course l string courseName Course() ( course c new Course(); ?.courseName "Oracle": class EJavaGuruPrivate f public static void main (String args1) f Course c new Course) c. cours eName "Java"; System.out.println(c.courseNamu) i a The code will print Java. b The code will print Oracle. c The code will not compile. d The code will throw an exception or an error at runtime. Q7-2. Select the correct option(s): a You cannot handle runtime exceptions b You should not handle errors. e If a method throws a checked exception, it must be either handled by bh method or specified in its throws clause. d If a method throws a runtime exception, it may include the exception in is throws clause. e Runtime exceptions are checked exceptions. Q7-3. Examine the following code and select the correct option (s): class EJavaGuruExcep ( public static void main(String args [1)i EJavaGuruExcep var new EJavaGuruExcep) var.printArrValues (args): void printArrValues (String[] arr) ( try f ) catch (NullPointerBxception e) ( ) catch (Indexoutof BoundsException e) ( ) catch (ArrayIndexoutof Bounds Exception e) ( System.out.printin(arr [O]arr [1]) System.out.println("NullPointerException") system.out.printin ("Indexoutof BoundsException") system.out.printin("ArrayIndexoutofBoundaException

Explanation / Answer

1. The code will print java.

Reason : Course c = new Course() ; this line of code will create an object of type course with coursename =Oracle beacuse of constructor call

c.coursename = Java this change coursename from oracle to Java.

2.

Both c and d are correct.

Reason : A checked exception is a type of exception that must be either caught or declared in the method in which it is thrown.

Runtime exception are unchecked exceptions that can be thrown without being caught or declared.

THUMBS UP IF YOU ARE SATISFIED WITH ANSWER OTHERWISE REPLY WITH YOUR CONCERN.