Tuesday, July 04, 2006

Some basics of Java which I regularly forget

  1. Real numbers are treated as double unless specifically flagged as float by marking the value with an 'F'
  2. java.io.File is a pointer to the file rather than a reference to its location and by itself does not encapsulate the physical file.
  3. Integer values are treated as "int" rather than long,
  4. so long micros = 24*60*60*1000*1000 would result in a value different from expectation. so flag the values with an 'L' if you don't want them to be messed with
  5. When using BigDecimal, pass a String representation of the double value rather than the double value to the constructor.
  6. Use fill with GridBagLayout else the component won't occupy the grid area
  7. painting is at two level, System event; when a component is added or removed and VM event; when a component is resized

No comments: