BASIC / NOTES</>↗Basic25 Oct 2010
The only way you can access an object is through a reference variable. A reference variable is declared to be of a specific type and that type can never be changed. Reference variables can be declared as static variables, instance variables, method parameters, or local variables. A reference variable that is declared as final can’t […]
BASIC / NOTES</>↗Basic25 Oct 2010
To check whether an object is of a particular type (class or interface type) you can use instanceof operator. The instanceof operator is used only for object reference variable. x instanceof y can be read as x is-a y. The instanceof returns true if the reference variable being tested is of the type being compared […]
SWING / NOTES</>↗Swing25 Oct 2010
This example shows you how to create a simple JTextArea component in Java Swing application. First you’ll create an instance of JTextAread and passes the number of rows and columns. Next to add a scroll ability you can wrap the component inside a JScrollPane. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class TextAreaDemo extends JPanel […]
BASIC / NOTES</>↗Basic25 Oct 2010
Relational operators used to compare any combination of integers, floating-point numbers, or characters. The result of relational operators is always in a boolean value, true or false. It is mostly used in an if statement test. There are four relational operators in Java: > greater than >= greater than or equal to < less than […]
BASIC / NOTES</>↗Basic25 Oct 2010
Equality operator is used to compare two similar things (numbers, characters, boolean, primitives and object references). Equality operator will always result in boolean value (true or false). For object reference, it will return true if only both reference variables refer to the same object. package org.kodejava.basic; public class EqualityDemo { public static void main(String[] args) […]
BASIC / NOTES</>↗Basic25 Oct 2010
The && operator also known as conditional-AND operator or short circuit AND. This operator exhibit “short-circuiting” behavior, which means that the second operand is evaluated only if needed. The && operator evaluate only boolean values. For an AND (&&) expression to be true, both operands must be true. If the first operand resolves false, then […]