Question: 5. What will happen when the following code is executed? class A implements Cloneable { public int i, j, k; String str = (Hello There);

5. What will happen when the following code is executed?

class A implements Cloneable { public int i, j, k; String str = ("Hello There"); public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) {} } } class B extends A { public B() { i = 5; j = 3; k= -4; } }

6. What value is returned when method func(4) is invoked? public double SquareRoot( double value ) throws ArithmeticException { if (value >= 0) return Math.sqrt( value ); else throw new ArithmeticException(); } public double func(int x) { double y = (double) x; try { y = SquareRoot( y ); } catch(ArithmeticException e) { y = 0; } finally { --y; } return y; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!