Given:class Bird {public void fly () { System.out.print("Can fly"); }}class Penguin extends Bird {public void fly () { System.out.print("Cannot fly"); }}and the code fragment:class Birdie {public static void main (String [ ] args) {fly( ( ) -> new Bird ( ));fly (Penguin : : new);}/* line n1 */}Which code fragment, when inserted at line n1, enables the Birdie class to compile?
Given the code fragment:public void recDelete (String dirName) throws IOException {File [ ] listOfFiles = new File (dirName) .listFiles();if (listOfFiles ! = null && listOfFiles.length >0) {for (File aFile : listOfFiles) {if (aFile.isDirectory ()) {recDelete (aFile.getAbsolutePath ());} else {if (aFile.getName ().endsWith (".class"))aFile.delete ();}}}}Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.Assume that -What is the result?.class files in the Projects directory and its subdirectories.
Given:1. abstract class Shape {2. Shape ( ) { System.out.println ("Shape"); }3. protected void area ( ) { System.out.println ("Shape"); }4. }5.6. class Square extends Shape {7. int side;8. Square int side {9. /* insert code here */10. this.side = side;11. }12. public void area ( ) { System.out.println ("Square"); }13. }14. class Rectangle extends Square {15. int len, br;16. Rectangle (int x, int y) {17. /* insert code here */18. len = x, br = y;19. }20. void area ( ) { System.out.println ("Rectangle"); }21. }Which two modifications enable the code to compile? (Choose two.)
Given the code fragment:Map<Integer, String> books = new TreeMap<>();books.put (1007, "A");books.put (1002, "C");books.put (1001, "B");books.put (1003, "B");System.out.println (books);What is the result?
Given:class Sum extends RecursiveAction { //line n1 static final int THRESHOLD_SIZE = 3; int stIndex, lstIndex; int [ ] data; public Sum (int [ ]data, int start, int end) { this.data = data; this stIndex = start; this. lstIndex = end;}protected void compute ( ) {int sum = 0;if (lstIndex "" stIndex <= THRESHOLD_SIZE) {for (int i = stIndex; i < lstIndex; i++) {sum += data [i];}System.out.println(sum);} else {new Sum (data, stIndex + THRESHOLD_SIZE, lstIndex).fork( );new Sum (data, stIndex,Math.min (lstIndex, stIndex + THRESHOLD_SIZE)).compute ();}}}and the code fragment:ForkJoinPool fjPool = new ForkJoinPool ( );int data [ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}fjPool.invoke (new Sum (data, 0, data.length));and given that the sum of all integers from 1 to 10 is 55.Which statement is true?
Given the definition of the Vehicle class:Class Vehhicle {int distance; //line n1Vehicle (int x) {this distance = x;}public void increSpeed(int time) { //line n2int timeTravel = time; //line n3class Car {int value = 0;public void speed () {value = distance /timeTravel;System.out.println ("Velocity with new speed"+value+"kmph");}}new Car().speed();}}and this code fragment:Vehicle v = new Vehicle (100);v.increSpeed(60);What is the result?Velocity with new speed -