SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API11 May 2007

How do I reverse a string by word?

In the other examples on this website you might have seen how to reverse a string using StringBuffer, StringUtils from Apache Commons Lang library or using the CharacterIterator. In this example you’ll see another way that you can use to reverse a string by word. Here we use the StringTokenizer and the Stack class. package […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API07 May 2007

How do I convert varargs to an array?

Varargs can be seen as a simplification of array when we need to pass a multiple value as a method parameter. Varargs itself is an array that automatically created, for these reason you will be enabled to do things you can do with array to varargs. In the example below you can see the messages […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API02 May 2007

How do I remove trailing white space from a string?

The trim() method of a String class removes both leading and trailing white space from a string. In this example we use a regular expression to remove only the trailing white spaces from a string. package org.kodejava.lang; public class TrailingSpace { public static void main(String[] args) { String text = " tattarrattat "; System.out.println("Original = […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API27 Apr 2007

How do I remove leading white space from a string?

The trim() method of a String class removes both leading and trailing white space from a string. In this example we use a regular expression to remove only the leading white spaces from a string. package org.kodejava.lang; public class LeadingSpace { public static void main(String[] args) { String text = " tattarrattat "; System.out.println("Original = […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API25 Apr 2007

How do I create a queue using LinkedList class?

package org.kodejava.util; import java.util.LinkedList; import java.util.Queue; public class QueueDemo { public static void main(String[] args) { // Create an instance of a queue, ere we use the LinkedList class which // implements the Queue interface. Add some elements to the queue using // the offer method. Queue<String> queue = new LinkedList<>(); queue.offer("First visitor"); queue.offer("Second visitor"); […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing21 Apr 2007

How do I handle a window closing event in Swing?

Here you will see how to handle the window closing event of a JFrame. What you need to do is to implement a java.awt.event.WindowListener interface and call the frame addWindowListener() method to add the listener to the frame instance. To handle the closing event implements the windowClosing() method of the interface. Instead of implementing the […]

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.