BASIC / NOTES</>↗Basic13 Apr 2008
package org.kodejava.lang; public class OrDemo { public static void main(String[] args) { int numberA = 16; int numberB = 4; // Operator "|" is used for doing bitwise OR operation int result = numberA | numberB; System.out.println(numberA + " | " + numberB + " = " + result); // Print the result in binary […]
BASIC / NOTES</>↗Basic10 Apr 2008
package org.kodejava.lang; public class AndDemo { public static void main(String[] args) { int numberA = 16; int numberB = 16; // Operator "&" is used for doing bitwise AND operation int result = numberA & numberB; System.out.println(numberA + " & " + numberB + " = " + result); // Print the result in binary […]
BEANS / NOTES</>↗Beans09 Apr 2008
package org.kodejava.bean; import java.beans.*; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; public class BeanToXmlTransient { private Long id; private String itemName; private String itemColour; private Integer itemQuantities; static { try { // In this block will change the attribute type of the // itemQuantities to transient, so it will be not serialized // to xml when […]
CORE API / NOTES</>↗Core API06 Apr 2008
package org.kodejava.util; import java.util.LinkedList; import java.util.List; public class LinkedListToArray { public static void main(String[] args) { List<String> list = new LinkedList<>(); list.add("Blue"); list.add("Green"); list.add("Purple"); list.add("Orange"); // Converting LinkedList to array can be done by calling the toArray() // method of the List; String[] colors = new String[list.size()]; list.toArray(colors); for (String color : colors) { System.out.println("c...
BEANS / NOTES</>↗Beans05 Apr 2008
In the previous example you can see how to convert a bean into an XML persistence. Now we’ll do the opposite, converting the XML back to a bean. For the BeanToXML class use in this example please refer to How do I convert a bean to XML persistence? example. package org.kodejava.bean; import java.beans.XMLDecoder; import java.io.BufferedInputStream; […]
BEANS / NOTES</>↗Beans03 Apr 2008
package org.kodejava.bean; import java.beans.XMLEncoder; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; public class BeanToXML { private Long id; private String itemName; private String itemColour; private Integer itemQuantities; public static void main(String[] args) { BeanToXML bean = new BeanToXML(); bean.setId(1L); bean.setItemName("T-Shirt"); bean.setItemColour("Dark Red"); bean.setItemQuantities(100); try { XM...