CORE API / CATATAN</>↗Core API27 Mar 2007
This example shows you how to use the String.format() method to add zero padding to a number. If you just want to print out the result you can use System.out.format(). This method is available since Java 1.5, so If you use a previous version you can use the NumberFormat class, see: How do I format […]
JDBC / CATATAN</>↗JDBC23 Mar 2007
A batch statement can be used to execute multiple update commands as single unit in a database manipulation. This statement in the database is not executed one by one but as a single execution instead. In some cases, using a batch update can be more efficient than to execute the commands separately. In this example, […]
APPLET / CATATAN</>↗Applet22 Mar 2007
package org.kodejava.applet; import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public class AppletParameterExample extends Applet { private String name = ""; public void init() { // Here we read a parameter named name from the applet tag definition // in our html file. name = getParameter("name"); } public void paint(Graphics g) { g.setColor(Color.BLUE); g.drawString("Hello " + name […]
CORE API / CATATAN</>↗Core API19 Mar 2007
package org.kodejava.util; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class StringDateToLong { public static void main(String[] args) { // Here we have a string date, and we want to covert it to long value String today = "25/09/2021"; // Create a SimpleDateFormat which will be used to convert the string to // a […]
JDBC / CATATAN</>↗JDBC19 Mar 2007
Since JDBC 2.0 (JDK 1.2), a scrollable ResultSet was introduced to the java.sql API family. Using this ResultSet enables us to navigate the result set in forward or backward way. To enable the scrollable ResultSet, we need to create a statement object by defining the ResultSet type (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.TYPE_SCROLL_INSENSITIVE). If you define the ResultSet type […]
JDBC / CATATAN</>↗JDBC15 Mar 2007
In this example we are showing you how to use result set absolute() and relative() method to jump from one result set row to the other. When you pass a positive number as the parameter, you’ll move from the first record to the last. But if you pass a negative number as parameter, you’ll move […]