View RSS Feed

My Java Tips

  1. Copying Arrays

    by , 11-10-2011 at 05:10 PM (My Java Tips)
    Arrays are very useful and are commonly used in our Java programs. Array name is actually a pointer that points to the continuous memory location. Many Java developers make some mistakes while copying arrays, which become difficult to cater.

    Consider the following scenario:

    I have a String array called 'array' which have 5 elements in it. I declared another String array called 'array_tmp'. I want to copy the contents of 'array' to 'array_tmp'. One simple way is to do ...
    Tags: arrays, copying Add / Edit Tags
    Java SE
  2. Serializing Arrays

    by , 11-10-2011 at 04:08 PM (My Java Tips)
    We already know that we can serialize object of classes that implement serializable interface. Make a class that implements serializable interface, make an object of it and save it to disk. You may retrieve to confirm that the object has the required data or not. Vector class also implements serializable interface, so you can also store vectors on disk.

    How about Arrays?

    Arrays are of some type. Thing to note is which classes implement Serializable interface. Integer, ...
    Java SE