title: Size and Size on disk of a .txt file
body: <p>Opened up a new file in Notepad and inserted the sentence without the quotes, "Four score and seven years ago" in it. </p>
  
  <pre><code>Four              4 characters
  score             5 characters
  and               3 characters
  seven             5 characters 
  years             5 characters 
  ago               3 characters
  </code></pre>
  
  <p>TOTAL : 25 + 5 spaces = 30 characters.</p>
  
  <p>You will find that the file has a size of 30 bytes on disk: 1 byte for each character.
  Saved the file to disk under the name gettingSize.txt. 
  Then look at the size of the file. 
  As a rule, Each character consumes a byte.</p>
  
  <p>Size : 30 bytes<br>
  Size on Disk : 4.00 KB (4,096 bytes)</p>
  
  <p>The below paragraphs are copy pasted from a pdf.</p>
  
  <p>If you were to look at the file as a computer looks at it, you would find that each byte contains not a letter but a number -- the number is the ASCII code corresponding to the character (see below). So on disk, the numbers for the file look like this:</p>
  
  <p>F   o   u   r     a   n   d      s   e   v   e   n</p>
  
  <p>70 111 117 114 32 97 110 100 32 115 101 118 101 110</p>
  
  <p>By looking in the ASCII table, you can see a one-to-one correspondence between each character and the ASCII code used. Note the use of 32 for a space -- 32 is the ASCII code for a space. We could expand these decimal numbers out to binary numbers (so 32 = 00100000) if we wanted to be technically correct -- that is how the computer really deals with things.</p>
  
  <p>1) i know that every thing is stored in the form of bits and bytes, so what generally this means - "you would find that each byte contains not a letter but a number -- the number is the ASCII code corresponding to the character". A byte is 8 bits. So how does "each byte a number -- the number is the ASCII code". How can a byte contains a ASCII number(eg. 49 for '1') other than 0 and 1?</p>
  
  <p>2) What exactly is the difference between Size and Size on Disk? And How does ASCII and Unicode fit into it?</p>
  
  <p>3)In Java, Strings are objects. Can I say it be a multiple characters concated together? 
  String str = "Four score and seven years ago"
  So how does a str stored in memory. Is it in the same manner as saving in the notepad file?</p>