What is wrong with the following code, and how would you fix…
What is wrong with the following code, and how would you fix it?import java.io.FileWriter; import java.io.IOException; public class WriteFile { public static void main(String[] args) throws IOException { FileWriter writer = new FileWriter(“output.txt”); writer.write(“Hello World”); writer.write(“This is a test”); }}
Read DetailsWhat is the output of the following code?int[][] arr = { {1,…
What is the output of the following code?int[][] arr = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr[i].length; j++) { if (arr[i][j] % 2 == 0) { System.out.print(arr[i][j] + " "); } }}
Read Details