CORE API / NOTES</>↗Core API19 Feb 2006
What date, month, year, day-of-week, day-of-month, day-of-year is it today? If we want to answer these question we can use java.util.Calendar and java.util.GregorianCalendar which is the implementation of Calendar abstract class. These classes can help us to get integer value such as date, month, year from a Date object. Let’s see the example code. package […]
CORE API / NOTES</>↗Core API18 Feb 2006
To get the minimum or maximum value of a primitive data types such as byte, short, int, long, float and double we can use the wrapper class provided for each of them, the wrapper classes are Byte, Short, Integer, Long, Float and Double which is located in java.lang package. package org.kodejava.lang; public class MinMaxExample { […]
CORE API / NOTES</>↗Core API17 Feb 2006
The following code shows how we can convert a string representation of date into java.util.Date object. To convert a string of date we can use the help from java.text.SimpleDateFormat that extends java.text.DateFormat abstract class. package org.kodejava.text; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Date; public class ConvertStringTo...
CORE API / NOTES</>↗Core API13 Feb 2006
Using Arrays.equals() methods we can compare if two arrays are equal. Two arrays are considered to be equal if their length, each element in both arrays are equal and in the same order to one another. package org.kodejava.util; import java.util.Arrays; public class CompareArrayExample { public static void main(String[] args) { String[] abc = {"Kode", "Java", […]
CORE API / NOTES</>↗Core API12 Feb 2006
There are times when we want to convert data from primitive data types into a string, for instance when we want to format output on the screen or simply mixing it with other string. Using a various static method String.valueOf() we can get a string value of them. Here is the code sample: package org.kodejava.lang; […]
CORE API / NOTES</>↗Core API11 Feb 2006
This example shows you how to create a repeated sequence of characters. To do this, we use the Arrays.fill() method. This method fills an array of char with a character. package org.kodejava.util; import java.util.Arrays; public class RepeatCharacterExample { public static void main(String[] args) { char c = '*'; int length = 10; // creates a […]