Java Java Data Structures Efficiency! Design the UI

Diego Marrs
Diego Marrs
8,243 Points

A few questions.

Hello, I have a couple of questions regarding this video:

  1. I don't understand what '' does...
  2. What does 'Buffered' and 'InputStream' reader do?
  3. What is the difference between 'System.out.printf' and 'System.out.print'?


1 Answer

Philip Gales
Philip Gales
15,038 Points

I am no Java expert, and have yet to scratch the surface of Oracle's Java documentation, but here is what I understand everything to mean.

1 . is the opposite of System.out.print. Instead of writing data to the console using System.out, you use to read input from the console.

2 a. Buffered Streams (Buffered) is similar to how when you watch Netflix and you notice the circle spinning as it is waiting to load more of your video clip. More specifically, unbuffered input/output is handled by the underlying OS. This makes your program very inefficient and since each request requires a lot of operations to take place for each byte of data. When you use buffers, you read data is large chunks and store it in a buffer, then you look at that data one-by-one.

2 b. Streams like InputStream are for reading and writing text. If you're not reading or writing to a console (i.e. not using you are using Streams). I just think reading data is if it is from the console and InputStream if it is a file.

3 . System.out.printf = System.out.format, which is a formatted string. I can not really think of a way to explain this so I will link you to this blog.