#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.
#WRK!
Do you want to benchmark your REST APIs.
I recently used WRK alongside with some LUA Scripts to Benchmark my REST APIs has developed in a micro-service project.
I suggest using it. it is faster than jMeter and needing less resources than it.
It is console base tool and you can run it easily on any remote server.
A little tricky to be used efficiently and you need to write LUA scripts for complex benchmarks; for e.g. authentication with your REST end-points and Posting complex JSON as request body and etc.
very Basic Example without LUA:
wrk -t10 -c100 -d10s http://localhost:9090/touraj_ebrahini.html
t: number of threads
c: number of connections
d: duration in seconds
—------------------------------------------------------------------------------------—
Testing with a Simple LUA Script:
wrk -t2 -c4 -d2s -s /opt/luawrk/test.lua http://localhost:9090/touraj/test/restapi/{path variable}
test.lua:
wrk.method = "POST"
wrk.body = "{'num': 24233,'name':'wrk_disp','list': [{'name':'contact1', 'num':234324},{'name':'contact2', 'num':234324}]}"
wrk.headers["Content-Type"]= "application/json"
wrk.headers["Authorization"]= "Basic wrkhdgreheydfgdmanksflol3Kbyedf="
wrk.headers["Cache-Control"]= "no-cache"
@javaCode☕️
Do you want to benchmark your REST APIs.
I recently used WRK alongside with some LUA Scripts to Benchmark my REST APIs has developed in a micro-service project.
I suggest using it. it is faster than jMeter and needing less resources than it.
It is console base tool and you can run it easily on any remote server.
A little tricky to be used efficiently and you need to write LUA scripts for complex benchmarks; for e.g. authentication with your REST end-points and Posting complex JSON as request body and etc.
very Basic Example without LUA:
wrk -t10 -c100 -d10s http://localhost:9090/touraj_ebrahini.html
t: number of threads
c: number of connections
d: duration in seconds
—------------------------------------------------------------------------------------—
Testing with a Simple LUA Script:
wrk -t2 -c4 -d2s -s /opt/luawrk/test.lua http://localhost:9090/touraj/test/restapi/{path variable}
test.lua:
wrk.method = "POST"
wrk.body = "{'num': 24233,'name':'wrk_disp','list': [{'name':'contact1', 'num':234324},{'name':'contact2', 'num':234324}]}"
wrk.headers["Content-Type"]= "application/json"
wrk.headers["Authorization"]= "Basic wrkhdgreheydfgdmanksflol3Kbyedf="
wrk.headers["Cache-Control"]= "no-cache"
@javaCode☕️
#Java
#Spring Boot
#Semantic UI
#Kalah Game
Kalah, also called Kalaha or Mancala, is a game in the mancala family imported in the United States by William Julius Champion, Jr. in 1940.
In youtube you can watch what has been developed for making KALAH game with Java, Spring Boot and Semantic UI.
I suggest Semantic UI as an alternative to Bootstrap that is very light wight, strong and feature-rich.
https://www.youtube.com/watch?v=nAedcao7p64&t=313s
@javaCode☕️
#Spring Boot
#Semantic UI
#Kalah Game
Kalah, also called Kalaha or Mancala, is a game in the mancala family imported in the United States by William Julius Champion, Jr. in 1940.
In youtube you can watch what has been developed for making KALAH game with Java, Spring Boot and Semantic UI.
I suggest Semantic UI as an alternative to Bootstrap that is very light wight, strong and feature-rich.
https://www.youtube.com/watch?v=nAedcao7p64&t=313s
@javaCode☕️
YouTube
kalah Game Developed By Touraj Ebrahimi
I have developed Kalah (Mancala) Game With #java #Springboot #SemanticUI.
This is two player version.
You can download or fork from my github and extend it. My Github: toraj58
For more information about Kalah game and its history you can refer to Wikipedia:…
This is two player version.
You can download or fork from my github and extend it. My Github: toraj58
For more information about Kalah game and its history you can refer to Wikipedia:…
#java
#kafka
#Prometheus
#Docker
#JMX
#Grafana
#metrics
I designed an Ecosystem for Monitoring Kafka base on metrics and JMX with Prometheus, Grafana, Docker and JMX Collector.
You can find document here:
https://www.slideshare.net/TourajEbrahimi/kafka-monitoring-and-metrics
@javaCode☕️
#kafka
#Prometheus
#Docker
#JMX
#Grafana
#metrics
I designed an Ecosystem for Monitoring Kafka base on metrics and JMX with Prometheus, Grafana, Docker and JMX Collector.
You can find document here:
https://www.slideshare.net/TourajEbrahimi/kafka-monitoring-and-metrics
@javaCode☕️
SlideShare
Kafka monitoring and metrics
Kafka monitoring and metrics - Download as a PDF or view online for free
#Composite_Design_Pattern
👉Problem
Application needs to manipulate a hierarchical collection of "primitive" and "composite" objects. Processing of a primitive object is handled one way, and processing of a composite object is handled differently. Having to query the "type" of each object before attempting to process it is not desirable.
@javaCode☕️
👉Problem
Application needs to manipulate a hierarchical collection of "primitive" and "composite" objects. Processing of a primitive object is handled one way, and processing of a composite object is handled differently. Having to query the "type" of each object before attempting to process it is not desirable.
@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☕️