Difference between object and class in Scala.

Object so in scala object is a singleton instance of the class, lets explain with small snippet. object test { def addPlusOne(a:Int) = a+1; } So when your calling the function instance is

Flyweight Pattern in java.

Flyweight pattern is categorised as structural pattern,Which is used to reduce number of object creations by using existing similar objects which in turn helps in reducing the memory foot print and increasing