CORE API / NOTES</>↗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 / NOTES</>↗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 / NOTES</>↗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 / NOTES</>↗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 […]
CORE API / NOTES</>↗Core API05 Sep 2006
The following code snippet demonstrates how to get some part from a string. To do this we use the String.substring() method. The first substring() method take a single parameter, beginIndex, the index where substring start. This method will return part of string from the beginning index to the end of the string. The second method, […]
BASIC / NOTES</>↗Basic02 Sep 2006
When we create a Java application we might want to pass a couple of parameters to our program. To get the parameters passed from the command line we can read it from the main(String[] args) method arguments. To make a class executable we need to create a main() method with the following signatures: public static […]