Tuesday, 27 July 2010

The Terrible Dangers of Autoboxing (Part 2)

Solution to part 1:
j is equal to m
j is equal to K
K is equal to m

The result of one of the Object being null, will of course cause a NullPointerException.

Part 2:

class Autoboxing


    public static void main(String[] args)
    {
        Integer a = 10;
        Integer b = 10;
        Integer c = 1000;
        Integer d = 1000;
        System.out.println(a == b); //true
        System.out.println(c == d); //false
    }

};

Please explain.

(Found it in my Linkedin groups "Sun Certified Java Programmer" here)


References

Most common gotchas in Java
http://vanillajava.blogspot.nl/2014/02/most-common-gotchas-in-java.html

Monday, 26 July 2010

The Cycle

Somewhere during the lifetime of a software development project, especially when concerning frameworks, the following things happen:

  1. a software project is started
  2. people notice that it is convenient and easy to use
  3. people demand new changes, and additional functionality
  4. the small software project starts to grow into the form of a framework
  5. the small software project becomes big, unruly, difficult to use, slow, hard to maintain, has all sorts of functionality that most people do not need.
  6. some people grow tired/irritated at the state of things
  7. some people have the great idea to make something better...

Somewhere,... a software project is started.