☕️JAVA Language Community
2.91K subscribers
144 photos
7 videos
31 files
42 links
☕️ Software, IT, Java, news
💻 IT highlights
🎯 AI update
🖥⌨️🖱
Download Telegram
#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☕️
#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☕️
#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☕️
#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☕️
#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☕️
#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☕️
#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☕️
#java
#spring
#work
#life

Let's have some fun friends:
My Poem influenced by #bobdylan One More Cup Of Coffee
☕️☕️

One more Line of #Java for #Spring
https://www.youtube.com/watch?v=CB1Yq4zVC70
#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☕️
#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☕️