What is InputStream & Output Stream? Why and when do we use them?

前端 未结 8 1034
予麋鹿
予麋鹿 2020-11-29 14:09

Someone explain to me what InputStream and OutputStream are?

I am confused about the use cases for both InputStream and

8条回答
  •  余生分开走
    2020-11-29 15:10

    An output stream is generally related to some data destination like a file or a network etc.In java output stream is a destination where data is eventually written and it ends

    import java.io.printstream;
    
    class PPrint {
        static PPrintStream oout = new PPrintStream();
    }
    
    class PPrintStream {
        void print(String str) { 
            System.out.println(str)
        }
    }
    
    class outputstreamDemo {
        public static void main(String args[]) {
            System.out.println("hello world");
            System.out.prinln("this is output stream demo");
        }
    }
    

提交回复
热议问题