☕️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

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☕️
#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 Language Community
#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☕️
1️⃣IP Address
IP address is a unique number assigned to a node of a network e.g. 192.168.0.1 . It is composed of octets that range from 0 to 255.
It is a logical address that can be changed.

2️⃣Protocol
A protocol is a set of rules basically that is followed for communication. For example:
* TCP
* FTP
* Telnet
* SMTP
* POP etc.

3️⃣Port Number
The port number is used to uniquely identify different applications. It acts as a communication endpoint between applications.
The port number is associated with the IP address for communication between two applications.

4️⃣MAC Address
MAC (Media Access Control) Address is a unique identifier of NIC (Network Interface Controller). A network node can have multiple NIC but each with unique MAC.

5️⃣Connection-oriented and connection-less protocol
In connection-oriented protocol, acknowledgement is sent by the receiver. So it is reliable but slow. The example of connection-oriented protocol is TCP.
But, in connection-less protocol, acknowledgement is not sent by the receiver. So it is not reliable but fast. The example of connection-less protocol is UDP.

6️⃣Socket
A socket is an endpoint between two way communication.

@javaCode☕️