#Bridge_Design_Pattern
👉Rules of thumb
▪️Adapter makes things work after they're designed; Bridge makes them work before they are.
▪️Bridge is designed up-front to let the abstraction and the implementation vary independently. Adapter is retrofitted to make unrelated classes work together.
▪️State, Strategy, Bridge (and to some degree Adapter) have similar solution structures. They all share elements of the "handle/body" idiom. They differ in intent - that is, they solve different problems.
▪️The structure of State and Bridge are identical (except that Bridge admits hierarchies of envelope classes, whereas State allows only one). The two patterns use the same structure to solve different problems: State allows an object's behavior to change along with its state, while Bridge's intent is to decouple an abstraction from its implementation so that the two can vary independently.
▪️If interface classes delegate the creation of their implementation classes (instead of creating/coupling themselves directly), then the design usually uses the Abstract Factory pattern to create the implementation objects.
@javaCode☕️
👉Rules of thumb
▪️Adapter makes things work after they're designed; Bridge makes them work before they are.
▪️Bridge is designed up-front to let the abstraction and the implementation vary independently. Adapter is retrofitted to make unrelated classes work together.
▪️State, Strategy, Bridge (and to some degree Adapter) have similar solution structures. They all share elements of the "handle/body" idiom. They differ in intent - that is, they solve different problems.
▪️The structure of State and Bridge are identical (except that Bridge admits hierarchies of envelope classes, whereas State allows only one). The two patterns use the same structure to solve different problems: State allows an object's behavior to change along with its state, while Bridge's intent is to decouple an abstraction from its implementation so that the two can vary independently.
▪️If interface classes delegate the creation of their implementation classes (instead of creating/coupling themselves directly), then the design usually uses the Abstract Factory pattern to create the implementation objects.
@javaCode☕️
#Java_Interview_Question
127) What is serialization?
Serialization is a process of writing the state of an object into a byte stream.It is mainly used to travel object's state on the network.
@javaCode☕️
127) What is serialization?
Serialization is a process of writing the state of an object into a byte stream.It is mainly used to travel object's state on the network.
@javaCode☕️
☕️JAVA Language Community
Photo
#Java_Interview_Question
👉Serialization in Java
Serialization in java is a mechanism of writing the state of an object into a byte stream.
It is mainly used in Hibernate, RMI, JPA, EJB and JMS technologies.
The reverse operation of serialization is called deserialization.
👉Advantage of Java Serialization
It is mainly used to travel object's state on the network (known as marshaling).
@javaCode☕️
👉Serialization in Java
Serialization in java is a mechanism of writing the state of an object into a byte stream.
It is mainly used in Hibernate, RMI, JPA, EJB and JMS technologies.
The reverse operation of serialization is called deserialization.
👉Advantage of Java Serialization
It is mainly used to travel object's state on the network (known as marshaling).
@javaCode☕️
☕️JAVA Language Community
#Java_Interview_Question 👉Serialization in Java Serialization in java is a mechanism of writing the state of an object into a byte stream. It is mainly used in Hibernate, RMI, JPA, EJB and JMS technologies. The reverse operation of serialization is called…
👉java.io.Serializable interface
Serializable is a marker interface (has no data member and method). It is used to "mark" java classes so that objects of these classes may get certain capability. The Cloneable and Remote are also marker interfaces.
It must be implemented by the class whose object you want to persist.
The String class and all the wrapper classes implements java.io.Serializable interface by default.
@javaCode☕️
Serializable is a marker interface (has no data member and method). It is used to "mark" java classes so that objects of these classes may get certain capability. The Cloneable and Remote are also marker interfaces.
It must be implemented by the class whose object you want to persist.
The String class and all the wrapper classes implements java.io.Serializable interface by default.
@javaCode☕️
#Java_Interview_Question
👉ObjectOutputStream class
The ObjectOutputStream class is used to write primitive data types and Java objects to an OutputStream. Only objects that support the java.io.Serializable interface can be written to streams.
👉ObjectInputStream class
An ObjectInputStream deserializes objects and primitive data written using an ObjectOutputStream.
@javaCode☕️
👉ObjectOutputStream class
The ObjectOutputStream class is used to write primitive data types and Java objects to an OutputStream. Only objects that support the java.io.Serializable interface can be written to streams.
👉ObjectInputStream class
An ObjectInputStream deserializes objects and primitive data written using an ObjectOutputStream.
@javaCode☕️
#Java_Interview_Question
128) What is Deserialization?
Deserialization is the process of reconstructing the object from the serialized state.It is the reverse operation of serialization.
@javaCode☕️
128) What is Deserialization?
Deserialization is the process of reconstructing the object from the serialized state.It is the reverse operation of serialization.
@javaCode☕️
#Java_Interview_Question
129) What is transient keyword?
If you define any data member as transient,it will not be serialized.
👉more details
▪️Java Transient Keyword
Java transient keyword is used in serialization. If you define any data member as transient, it will not be serialized.
Let's take an example, I have declared a class as Student, it has three data members id, name and age. If you serialize the object, all the values will be serialized but I don't want to serialize one value, e.g. age then we can declare the age data member as transient.
@javaCode☕️
129) What is transient keyword?
If you define any data member as transient,it will not be serialized.
👉more details
▪️Java Transient Keyword
Java transient keyword is used in serialization. If you define any data member as transient, it will not be serialized.
Let's take an example, I have declared a class as Student, it has three data members id, name and age. If you serialize the object, all the values will be serialized but I don't want to serialize one value, e.g. age then we can declare the age data member as transient.
@javaCode☕️
#Java_Interview_Question
130)What is Externalizable?
Externalizable interface is used to write the state of an object into a byte stream in compressed format.It is not a marker interface.
@javaCode☕️
130)What is Externalizable?
Externalizable interface is used to write the state of an object into a byte stream in compressed format.It is not a marker interface.
@javaCode☕️
#Java_Interview_Question
131)What is the difference between Serializalble and Externalizable interface?
Serializable is a marker interface but Externalizable is not a marker interface.When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process.
@javaCode☕️
131)What is the difference between Serializalble and Externalizable interface?
Serializable is a marker interface but Externalizable is not a marker interface.When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process.
@javaCode☕️
#Java_Interview_Question
132)How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?
By InetAddress.getByName("192.18.97.39").getHostName() where 192.18.97.39 is the IP address.
@javaCode☕️
132)How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?
By InetAddress.getByName("192.18.97.39").getHostName() where 192.18.97.39 is the IP address.
@javaCode☕️
#Java_Interview_Question
133) What is reflection?
Reflection is the process of examining or modifying the runtime behaviour of a class at runtime.It is used in:
IDE (Integreted Development Environment) e.g. Eclipse, MyEclipse, NetBeans.
Debugger
Test Tools etc.
@javaCode☕️
133) What is reflection?
Reflection is the process of examining or modifying the runtime behaviour of a class at runtime.It is used in:
IDE (Integreted Development Environment) e.g. Eclipse, MyEclipse, NetBeans.
Debugger
Test Tools etc.
@javaCode☕️
#Design_Patterns
#Structural_patterns
#Composite_Design_Pattern
👉Intent
▪️Compose objects into tree structures to represent whole-part hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
▪️Recursive composition
▪️"Directories contain entries, each of which could be a directory."
▪️1-to-many "has a" up the "is a" hierarchy
@javaCode☕️
#Structural_patterns
#Composite_Design_Pattern
👉Intent
▪️Compose objects into tree structures to represent whole-part hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
▪️Recursive composition
▪️"Directories contain entries, each of which could be a directory."
▪️1-to-many "has a" up the "is a" hierarchy
@javaCode☕️
ActiveMQ persistence mode VS. Non-Persistence
#ActiveMQ
#Persistence
https://www.linkedin.com/pulse/activemq-persistence-mode-vs-non-persistence-touraj-ebrahimi
@javaCode☕️
#ActiveMQ
#Persistence
https://www.linkedin.com/pulse/activemq-persistence-mode-vs-non-persistence-touraj-ebrahimi
@javaCode☕️
Linkedin
ActiveMQ persistence mode VS. Non-Persistence
It this article I want to write about activemq and trade of between using persistence mode and non-persistence mode. As my experience each of them has its own cons and pros.