Static Member :-
What is a static member ? Static member is a member of a class that which is not interact or associate of an instance of a class. This can be access without creating a object of a class. Moreover static members are being executed when class load in to the memory. Further static members are accessible from any where and certain member is common for every instances. All objects use some instance of a static member.
There are two levels of access modifiers such as top level access and member level access.
Top level access
This is related to class definition. A class can be public or package-private.
HashMap is one of the most performing data structure in java collection framework. This provides constant time for both insertion and retrieval. This is used for large scale data since this is having high performance in insertion and retrieval. However this performance is depending on the two factors such as initial capacity and load factor. We can construct HashMap in four way and default constructor is having load factor is .75 and initial capacity as 16.
This is the pattern which ensures there will be only one instance of a class in JVM and it can be accessed via globally. Generally this pattern is used to be on caching, logging, settings and configurations and so on.
Static class has below properties such as : –
- Static Member – this keeps the instance of class.
- Private constructor – this avoids creating multiple instances from this class.
- Static public method – the only one instance can be accessed via globally through this method.
You will need to save data in shared preference when you are developing android applications. Below example show how to develop that functionality.
Prototype design pattern is a creational type design pattern. Instead of creating new objects you can clone existing object with this pattern and can be customized as you wanted. You can take advantages such as:-
- reduce needs of sub classing
- no need to worry about creating objects with complexities
- add or remove objects in run time.
First of all you have to read Factory Design Pattern before you learn about Abstract Factory Design Pattern. You can go through factory design Pattern article with this.