How to close telnet terminal in Linux and Windows (quit, exit not working)

The telnet is one of the most useful networking commands, which is used to check if a server is listening on a particular port on the remote host, but it's a little bit tricky to use, especially, if you are not using it daily. Though I have used telnet before, but when I use it after a long time, I actually forget how to close the telnet terminal and how to get out of it. I tried every possible command I can think of which is used to close, cancel a command, or exit from VIM editor in UNIX, e.g. Ctrl + C, quit, exit, q! and even the escape character '^]', only to realize that nothing is working. I finally managed to come out from telnet command prompt after a bit of struggle, and trial and error but I was surprised how difficult it can be  to use one of the top 10 networking commands in UNIX.

How to make Eclipse use spaces instead of tabs in Java editor

I use Eclipse IDE extensively to write Java programs for testing and example purpose, but when I copy those program in any text editors e.g. VIM, Notepad, TextPad or Edit plus, the indentation goes weird. I see a lot of white spaces which makes the program wider than expected. This happens because when you copy Java program from Eclipse to a text editor, tabs are converted to spaces and different editor has the different settings of tabs. UNIX text editors prefer tab is 8 spaces, Windows text editors, and IDEs  e.g. Eclipse treat tabs as 4 spaces. If you are like many Java programmer who is more comfortable with space than tabs because they give a true sense of spacing, you can always change the Java editor settings to use space instead of tabs in Eclipse. In this article, I am going to share how to make Eclipse uses spaces instead of tabs for Java editor, which you use while writing Java programs.

10 Examples of Joining String in Java 8 - StringJoiner and String.join()

It's quite common in day to day programming to join Strings e.g. if you have an array or List of String let's say {Sony, Apple, Google} and you want to join them by comma to produce another String "Sony, Apple, Google", there is not an easy way to do it in Java. You need to iterate through array or list and then use a StringBuilder to append a comma after each element and finally to remove the last comma because you don't want a comma after the last element. A JavaScript-like Array.join() method or join() method of Android's TextUtils class is what you need in this situation, but you won't find any of such method on String, StringBuffer, StringBuilder, Arrays, or Collections class until Java 8. Now, you have a class called StringJoiner which allows you to join multiple String by a delimiter.