JAVA: There are three errors with the program below (issues which would prevent the program from compiling). State what the errors are and why they occur. import java.util.Scanner; import java.io.FileOutputStream; import java.io.FileInputStream; import java.io.IOException; public class MyClass extends AnotherClass, ThirdClass { private int i; private String s; public MyClass(String s) { this.s = s; i = s.length(); } public abstract int doSomething(); public void readString() throws IOException { FileInputStream inFile = new FileInputStream("Text.txt"); Scanner scan = new Scanner(inFile); s = scan.next(); i = s.length(); inFile.close(); scan.close(); } public void writeString() throws IOException { FileOutputStream outFile = new FileOutputStream("Text.txt"); PrintWriter pw = new PrintWriter(outFile); pw.println(s); outFile.close(); } }
JAVA:
There are three errors with the
import java.util.Scanner;
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class MyClass extends AnotherClass, ThirdClass {
private int i;
private String s;
public MyClass(String s) {
this.s = s;
i = s.length();
}
public abstract int doSomething();
public void readString() throws IOException {
FileInputStream inFile = new FileInputStream("Text.txt");
Scanner scan = new Scanner(inFile);
s = scan.next();
i = s.length();
inFile.close();
scan.close();
}
public void writeString() throws IOException {
FileOutputStream outFile = new FileOutputStream("Text.txt");
PrintWriter pw = new PrintWriter(outFile);
pw.println(s);
outFile.close();
}
}
![There are three errors with the program below (issues which would prevent the program from
compiling). State what the errors are and why they occur.
import java.util.Scanner;
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class MyClass extends AnotherClass, ThirdClass {
private int i;
private string s;
}
public MyClass(Strings) {
this.s = 5;
i = s.length();
}
public abstract int dosomething();
public void readstring() throws IOException {
FileInputStream inFile = new FileInputStream("Text.txt");
Scanner scan = new Scanner(inFile);
s = scan.next();
i = s.length();
inFile.close();
scan.close();
}
public void writestring() throws IOException {
FileOutputStream outFile = new FileOutputStream("Text.txt");
Printwriter pw = new Printwriter(outFile);
pw.println(s);
outfile.close();
}](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0cc153ae-b205-4fb2-9991-7cf6a21d5016%2F6365569b-4c7d-4d0b-bf6e-944fd349eb98%2Fu6e4bct_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)