CORE API / CATATAN</>↗Core API28 Jun 2007
The code below use File.mkdirs() method to create a collection of directories recursively. It will create a directory with all its necessary parent directories. package org.kodejava.io; import java.io.File; public class CreateDirs { public static void main(String[] args) { // Define a deep directory structures and create all the // directories at once. String directories = […]
BASIC / CATATAN</>↗Basic28 Jun 2007
Here is an example of comparing two strings for equality without considering their case sensitivity. To do this we can use equalsIgnoreCase() method of the String class. Let’s see an example below: package org.kodejava.basic; public class EqualsIgnoreCase { public static void main(String[] args) { String uppercase = "ABCDEFGHI"; String mixed = "aBCdEFghI"; // To compare […]
CORE API / CATATAN</>↗Core API27 Jun 2007
package org.kodejava.lang; public class StringBuilderInsert { public static void main(String[] args) { StringBuilder alphabets = new StringBuilder("abcdfghopqrstuvwxyz"); System.out.println("alphabets = " + alphabets); // |a|b|c|d|f|g|h|i|…. // 0|1|2|3|4|5|6|7|8|… // // From the above sequence you can see that the index of the string is // started from 0, so when we insert a string in the fourth […]
CORE API / CATATAN</>↗Core API25 Jun 2007
This example demonstrate you how to use the StringBuilder delete(int start, int end) and deleteCharAt(int index) to remove a substring or a single character from a StringBuilder. package org.kodejava.lang; public class StringBuilderDelete { public static void main(String[] args) { StringBuilder lipsum = new StringBuilder("Lorem ipsum dolor sit " + "amet, consectetur adipisicing elit."); System.out.println("lipsum = […]
SERVLET / CATATAN</>↗Servlet25 Jun 2007
package org.kodejava.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.Enumeration; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(urlPatterns = "/context-init-param") public class ContextInitParameter...
SERVLET / CATATAN</>↗Servlet24 Jun 2007
package org.kodejava.servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; @WebServlet(name = "SessionLastAccessTime", urlPatterns = "/last-access-time") public class SessionLastAccessTime ext...