Question
Java Project Draw a class diagram for the below class (using UML notation) import java.io.BufferedReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; public class myData {
Java Project
Draw a class diagram for the below class (using UML notation)
import java.io.BufferedReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
public class myData {
public static void main(String[] args) {
String str;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter text (stop to quit).");
try (FileWriter fw = new FileWriter("test.txt")) {
do {
System.out.print(": ");
str = br.readLine();
if (str.compareTo("stop") == 0)
break;
str = str + " "; // add newline
fw.write(str);
} while (str.compareTo("stop") != 0);
} catch (IOException exc) {
System.out.println("I/O Error: " + exc);
}
}
}
1eimport java.io.BufferedReader; 2 import java.io.FileWriter; 3 import java.io.IOException; 4 import java.io.InputStreamReader; 6 public class myData [ 7 public static void main (String[] args) { String str; BufferedReader br new BufferedReader (new InputStreamReader (System.in)); System.out.println("Enter text ( stop' to quit)."); try (FileWriter fw= new FileWriter ("test.txt")| 10 do t System.out.print(": "); str br . readLine ( ) ; if (str.compareTo ("stop") 15 16 0) break str = str + " ". // add newline fw.write (str) 19 } while (str.compareTo ("stop") != 0); catch (IOException exc) 21 System. out.println("I/O Error:"exc)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started