Sitemap
Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

Follow publication

Member-only story

Java: Interesting and Cool Tricks

Leo N
7 min readJun 30, 2021

--

👉 1 >> Java String

concat() Vs the + Operator for Concatenation

intern()

As you can see, both str1 and str2 have the same content, but they are not equal initially.

We then use the intern() method so that str1 and str2 use the same memory pool. After we use intern(), str1 and str2 are equal.

👉2 >> Comment

In Java, there are two types of comments:

  • Single-line comment: A single-line comment starts and ends in the same line. To write a single-line comment, we can use the // symbol. For example:
  • Multi-line comment: When we want to write comments in multiple lines, we can use the multi-line comment. To write multi-line comments, we can use the /*….*/…

--

--

Leo N
Leo N

Written by Leo N

🇻🇳 🇸🇬 🇲🇾 🇦🇺 🇹🇭 Engineer @ GXS Bank, Singapore | MSc 🎓 | Technical Writer . https://github.com/nphausg

Responses (5)