Question: The following bytecode is generated by the Java compiler for the findRoots method: public int findRoots (double, double, double); Code: 0: dload_3 1: dload 3

The following bytecode is generated by the Java compiler for the findRoots method: public int findRoots (double, double, double); Code: 0: dload_3 1: dload 3 2: dmul 3: ldc2w #4 // double 4.0d 6: dload_1 7: dmul 8: dload 5 1. 10: dmul 11: dsub 10. 12: invokestatic #6 // Method java/lang/Math.sqrt: (D)D 46. dat 15: dstore 7 17: aload_0 18: dload_3 1 19: dneg 20: dload 7 22: dadd 23: ldc2_W #7 // double 2.0d 26: dload 1 27: dmul 4 #2 // Field firstRoot:D 7 28: ddiv 29: putfield 32: aload_0 S: 1108 33: dload_3 34: dneg 35: dload 0. G 37: dsub ov 38: ldc2_W 41: dload 1 ta 42: dmul 32. W 43: ddiv 30.01 44: putfield 47: iconst_0 48: ireturn #7 // double 2. Od #3 // Field secondRoot:D Complete the following table, which shows the mapping of Java source codes to the corresponding bytecode line numbers. Bytecode Lines (Start - End] * Java Source Code (b*b) (4 *a*c) sort = Math.sqrt((b* b)-4*a* c): = (-b + sart) firstRoot = (-b + sart) / (2 * a): (-b-sart) second Root = (-B - sqrt)/(2* a): -b return 0; Note: You don't need to write the bytecode, just mention the starting and ending line numbers in the table above. (8 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
