CORE API / CATATAN</>↗Core API01 Des 2006
Using the code below you can get a list of country names and its ISO code by using the locale class implementation in Java. package org.kodejava.util; import java.text.Collator; import java.util.*; public class CountryList { public static void main(String[] args) { // A collection to store our country object List<Country> countries = new ArrayList<>(); // Get […]
SERVLET / CATATAN</>↗Servlet27 Nov 2006
Here we have a simple example of creating a hit counter using servlet. The servlet updates the hits counter every time a page is visited and display the number of hits as an image. The image is generated at runtime using Java’s java.awt.Graphic2D and javax.imageio.ImageIO class. To store the number of visit data we create […]
SERVLET / CATATAN</>↗Servlet23 Nov 2006
Servlet is a Java solution for creating a dynamic web application, it can be compared with the old CGI technology. Using Servlet we can create a web application that can display information from a database, receive information from a web form to be stored in the application database. This example shows the very basic of […]
CORE API / CATATAN</>↗Core API19 Nov 2006
package org.kodejava.util; import java.util.Arrays; import java.util.Collections; import java.util.List; public class ArrayShuffle { public static void main(String[] args) { // Initialize the contents of our array String[] alphabets = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"}; // As the Collections.shuffle() method need a list for the parameter // we convert our array into […]
SECURITY / CATATAN</>↗Security14 Nov 2006
You are creating a user management system that will keep user profile and their credential or password. For security reason you’ll need to protect the password, to do this you can use the MessageDigest provided by Java API to encrypt the password. The code example below show you an example how to use it. package […]
CORE API / CATATAN</>↗Core API09 Nov 2006
Using for-each command to iterate arrays or a list can simplified our code. Below is an example how to do it in Java. The first loop is for iterating array and the second for iterating a list containing a some names. package org.kodejava.lang; import java.util.ArrayList; import java.util.List; public class ForEachExample { public static void main(String[] […]