Menu

[Solved]Java Create Java Class Stream Buffer Read Write Output Would Word Nice Weather Read Nice W Q37199895

java

create java class for stream which has buffer for read andwrite
the output would be
word: Nice weather
read: Nice weather

I have to include these
class Stream {
private String buffer;
//create code
}
public String read() {
//create code
}
public void write(String s) {
// create code
}
}

here is my code

class File {
public String content;
}
class Reader extends Stream {
private File ff;
  
public Reader(File h) {
ff = h;
}
  
class Writer extends Stream {
private File ff;
  
public Writer(File h) {
ff = h;
}
  
class Main {
public static void main(String[] args) {
File ff = new File();
       Writer writer = newWriter(ff);
       Reader reader = newReader(ff);
      
       writer.write(“Nice weather”);
       String msg = reader.read();
      
       System.out.println(” word:” +ff.msg);
       System.out.println(” read:” +msg);
}
}

Expert Answer


Answer to java create java class for stream which has buffer for read and write the output would be word: Nice weather read: Nice … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *