Question: There are some errors with the compulation of the java code below, please correct ut and send the source code with the output. Thank You

There are some errors with the compulation of the java code below, please correct ut and send the source code with the output. Thank You
import java.util.Arrays;
public class SimpleArrays{
String[] data = new String[4];
public SimpleArrays() {
Arrays.fill(data,"Hello, world");
}
public SimpleArrays (String val) {
Arrays.fill (data, val);
}
public String arrayConcat (int index) {
String output = "";
if (index >= data.length)
throw new ArrayIndexOutOfBoundsException();
for (int i = index; i
output += data[i] + "#";
}
output += data[data.length-1];
return output;
}
public String arrayConcat() {
int index = 0;
String output = "";
if (index >= data.length)
throw new ArrayIndexOutOfBoundsException();
for (int i = index; i
output += data[i] + "#";
}
output += data[data.length-l];
return output;
public String arrayCrop(int start, int end) {
if (start > end) {
int temp = start;
start = end;
end = temp;
if (start = data.length)
return "Fail";
if (start == end)
return "Match";
String output="";
for (int i = start; i
output += data[i]+"#";
}
output += data[end-1];
return output;
}
public static void main(String[] args) {
SimpleArrays myArrayl = new SimpleArrays();
String foundResultl = myArrayl.arrayConcat();
System.out.println(foundResultl);
SimpleArrays myArray2 = new SimpleArrays ();
String foundResult2 = myArray2.arrayConcat(2);
System.out.println(foundResult2);
SimpleArrays myArray3 = new SimpleArrays ("Hi you" );
String foundResult3 = myArray3.arrayConcat();
System.out.println(foundResult3);
SimpleArrays myArray4 = new SimpleArrays ("Hi you" );
String foundResult4 = myArray4.arrayConcat(2);
System.out.println(foundResult4);
SimpleArrays myArray5 = new SimpleArrays ( "Hi you" ) ;
String foundResult5 = myArray5 .arrayCrop(0,2);
System.out.println(foundResult5);
SimpleArrays myArray6 = new SimpleArrays ("Hi you" ) ;
String foundResult6 = myArray6.arrayCrop(3,2);
system.out.println(foundResult6);
SimpleArrays myArray7 = new SimpleArrays ( "Hi you" ) ;
String foundResult7 = myArray7.arrayCrop(0,6);
System.out.println(foundResult7);
SimpleArrays myArray8 = new SimpleArrays ("Hi you" ) ;
String foundResult8 = myArray8. arrayCrop(3,3);
System.out.println (foundResult8);
}
}
 There are some errors with the compulation of the java code
below, please correct ut and send the source code with the output.
Thank You import java.util.Arrays; public class SimpleArrays{ String[] data = new String[4];
public SimpleArrays() { Arrays.fill(data,"Hello, world"); } public SimpleArrays (String val) { Arrays.fill
(data, val); } public String arrayConcat (int index) { String output =
Compilation failed due to following error(s). Main.java:17: error: expected output += data[data. Length-1); Main.java:18: error: illegal start of type return output; Main.java:18: error: expected return output; Main.java:20: error: class, interface, or enum expected public String arrayConcat() { Main.java:22: error: class, interface, or enum expected String output = ""; Main.java:23: error: class, interface, or enum expected if (index >= data. length) Main.java:25: error: class, interface, or enum expected for (int i = index; i = data. length) Main.java:37: error: class, interface, or enum expected if (start = end) A Main.java:39: error: class, interface, or enum expected String output=""; A Main.java:40: error: class, interface, or enum expected for (int i = start; i

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!