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.

TAGLIB / NOTES</>↗
Taglib17 Aug 2009

How do use <c:forEach> JSTL tag?

The <c:forEach> tag in the core JSTL tag library is a useful tag when we want to iterate over a collection of data such as array. It is commonly used to render a tabular data in our web pages in form of HTML table. In the example below we display a weather data that we […]

Wayan · 3 min read
BASIC / NOTES</>↗
Basic15 Aug 2009

How do I get name of enum constant?

This example demonstrate how to user enum‘s name() method to get enum constant name exactly as declared in the enum declaration. package org.kodejava.basic; enum ProcessStatus { IDLE, RUNNING, FAILED, DONE; @Override public String toString() { return "Process Status: " + this.name(); } } public class EnumNameDemo { public static void main(String[] args) { for (ProcessStatus […]

Wayan · 1 min read
BASIC / NOTES</>↗
Basic12 Aug 2009

How do I use static import feature?

In order to use a static member of a class in Java we have to qualify the reference with the class name where they came from. For instance to access the PI and abs() from the Math class we should write: double circle = Math.PI * 10; int absolute = Math.abs(-100); For some time you […]

Wayan · 2 min read
BASIC / NOTES</>↗
Basic07 Aug 2009

How do I get ordinal value of enum constant?

This example demonstrate the use of enum ordinal() method to get the ordinal value of an enum constant. package org.kodejava.basic; enum Color { RED, GREEN, BLUE } public class EnumOrdinal { public static void main(String[] args) { // Gets the ordinal of this enumeration constant (its // position in its enum declaration, where the initial […]

Wayan · 1 min read
BASIC / NOTES</>↗
Basic06 Aug 2009

How do I define a field in enum type?

As we know that Java enumeration type is powerful compared to enum implementation in other programming language. Basically enum is class typed, so it can have constructors, methods and fields. In the example below you’ll see how a field is defined in an enumeration type. Because each constant value for the Fruit enum is a […]

Wayan · 2 min read
BASIC / NOTES</>↗
Basic05 Aug 2009

How do I get enum constant value corresponds to a string?

The valueOf() method of an enum type allows you to get an enum constant that the value corresponds to the specified string. Exception will be thrown when we pass a string that not available in the enum. package org.kodejava.basic; public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } package org.kodejava.basic; public class […]

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.