CORE API / CATATAN</>↗Core API22 Sep 2006
If you want to display some numbers that is formatted to a certain pattern, either in a Java Swing application or in a JSP file, you can utilize NumberFormat and DecimalFormat class to give you the format that you want. Here is a small example that will show you how to do it. In the […]
CORE API / CATATAN</>↗Core API19 Sep 2006
You want to convert a string representing a time into a time object in Java. As we know that Java represents time information in a class java.util.Date, this class keep information for date and time. Now if you have a string of time like 15:30:18, you can use a SimpleDateFormat object to parse the string […]
CORE API / CATATAN</>↗Core API16 Sep 2006
In this example we use LineNumberReader class to read file contents. What we try to do here is to get the line number of the read data. Instead of introducing another variable; an integer for instance; to keep track the line number we can utilize the LineNumberReader class. This class offers the getLineNumber() method to […]
CORE API / CATATAN</>↗Core API12 Sep 2006
package org.kodejava.lang; public class UserHomeExample { public static void main(String[] args) { // This is the key that we used to obtain user home directory // in the operating system String userHome = "user.home"; // We get the path by getting the system property with the // defined key above. String path = System.getProperty(userHome); // […]
CORE API / CATATAN</>↗Core API09 Sep 2006
package org.kodejava.lang; public class OperatingSystemInfo { public static void main(String[] args) { // The key for getting operating system name String name = "os.name"; // The key for getting operating system version String version = "os.version"; // The key for getting operating system architecture String architecture = "os.arch"; System.out.println("Name : " + System.getProperty(name)); System.out.println("Version: " […]
CORE API / CATATAN</>↗Core API07 Sep 2006
You have a problem that you want to add a delay for a couple of seconds in your program. Using Thread.sleep() method we can add delay in our application in a millisecond time. The Thread.sleep() need to be executed inside a try-catch block, and we need to catch the InterruptedException. Let’s see the code snippet […]