#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☕️
#Java_Interview_Question
134) Can you access the private method from outside the class?
Yes, by changing the runtime behaviour of a class if the class is not secured.
@javaCode☕️
134) Can you access the private method from outside the class?
Yes, by changing the runtime behaviour of a class if the class is not secured.
@javaCode☕️
#Java_Interview_Question
👉Java Networking Terminology
The widely used java networking terminologies are given below:
1️⃣IP Address
2️⃣Protocol
3️⃣Port Number
4️⃣MAC Address
5️⃣Connection-oriented and connection-less protocol
7️⃣Socket
@javaCode☕️
👉Java Networking Terminology
The widely used java networking terminologies are given below:
1️⃣IP Address
2️⃣Protocol
3️⃣Port Number
4️⃣MAC Address
5️⃣Connection-oriented and connection-less protocol
7️⃣Socket
@javaCode☕️
#Java_Interview_Question
135) What is the difference between ArrayList and Vector?
1️⃣ArrayList is not synchronized.
Vector is synchronized.
2️⃣ArrayList is not a legacy class.
Vector is a legacy class.
3️⃣ArrayList increases its size by 50% of the array size.
Vector increases its size by doubling the array size.
@javaCode☕️
135) What is the difference between ArrayList and Vector?
1️⃣ArrayList is not synchronized.
Vector is synchronized.
2️⃣ArrayList is not a legacy class.
Vector is a legacy class.
3️⃣ArrayList increases its size by 50% of the array size.
Vector increases its size by doubling the array size.
@javaCode☕️
#Java_Interview_Question
136) What is the difference between ArrayList and LinkedList?
1️⃣ArrayList uses a dynamic array. LinkedList uses doubly linked list.
2️⃣ArrayList is not efficient for manipulation because a lot of shifting is required. LinkedList is efficient for manipulation.
3️⃣ArrayList is better to store and fetch data. LinkedList is better to manipulate data.
@javaCode☕️
136) What is the difference between ArrayList and LinkedList?
1️⃣ArrayList uses a dynamic array. LinkedList uses doubly linked list.
2️⃣ArrayList is not efficient for manipulation because a lot of shifting is required. LinkedList is efficient for manipulation.
3️⃣ArrayList is better to store and fetch data. LinkedList is better to manipulate data.
@javaCode☕️
#Java_Interview_Question
137) What is the difference between Iterator and ListIterator?
Iterator traverses the elements in forward direction only whereas ListIterator traverses the elements in forward and backward direction.
1) Iterator traverses the elements in forward direction only. ListIterator traverses the elements in backward and forward directions both.
2) Iterator can be used in List, Set and Queue. ListIterator can be used in List only.
@javaCode☕️
137) What is the difference between Iterator and ListIterator?
Iterator traverses the elements in forward direction only whereas ListIterator traverses the elements in forward and backward direction.
1) Iterator traverses the elements in forward direction only. ListIterator traverses the elements in backward and forward directions both.
2) Iterator can be used in List, Set and Queue. ListIterator can be used in List only.
@javaCode☕️
👍1
#Java_Interview_Question
138) What is the difference between Iterator and Enumeration?
1) Iterator can traverse legacy and non-legacy elements.
Enumeration can traverse only legacy elements.
2) Iterator is fail-fast.
Enumeration is not fail-fast.
3) Iterator is slower than Enumeration.
Enumeration is faster than Iterator.
@javaCode☕️
138) What is the difference between Iterator and Enumeration?
1) Iterator can traverse legacy and non-legacy elements.
Enumeration can traverse only legacy elements.
2) Iterator is fail-fast.
Enumeration is not fail-fast.
3) Iterator is slower than Enumeration.
Enumeration is faster than Iterator.
@javaCode☕️
#Java_Interview_Question
139) What is the difference between List and Set?
List can contain duplicate elements whereas Set contains only unique elements.
@javaCode☕️
139) What is the difference between List and Set?
List can contain duplicate elements whereas Set contains only unique elements.
@javaCode☕️
👍1