Java Tutorials

141. The if-then Statement in Java

By: Ivan Lim : 2007-10-13

Description: The if-then statement is the most basic of all the control flow statements. It tells your program to execute a certain section of code only if a particular test evaluates to true. For example, the Bicycle class could allow the brakes to decrease the bicycle's speed only if the bicycle is already in motion. One possible implementation of the applyBrakes method could be as follows:


142. Summary of Operators in Java

By: Henry : 2007-10-13

Description: The following quick reference summarizes the operators supported by the Java programming language.


143. Bitwise and Bit Shift Operators example in Java

By: Grenfel : 2007-10-13

Description: The Java programming language also provides operators that perform bitwise and bit shift operations on integral types. The operators discussed here are less commonly used. Therefore, their coverage is brief; the intent is to simply make you aware that these operators exist.


144. Using continue Statement - example in Java

By: Priya Mani : 2007-10-13

Description: The continue statement skips the current iteration of a for, while , or do-while loop. The unlabeled form skips to the end of the innermost loop's body and evaluates the boolean expression that controls the loop. The following program, ContinueDemo , steps through a String, counting the occurences of the letter "p". If the current character is not a p, the continue statement skips the rest of the loop and proceeds to the next character. If it is a "p", the program increments the letter count.


145. instanceof operator example in Java

By: Fanny Ong : 2007-10-13

Description: The instanceof operator compares an object to a specified type. You can use it to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements a particular interface.


146. The Unary Operators example in Java

By: Emiley J : 2007-10-13

Description: The unary operators require only one operand; they perform various operations such as incrementing/decrementing a value by one, negating an expression, or inverting the value of a boolean.


147. Operator Precedence in Java

By: Daniel Malcolm : 2007-10-13

Description: Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result.


148. arraycopy example in Java

By: Charles : 2007-10-13

Description: The System class has an arraycopy method that you can use to efficiently copy data from one array into another:


149. Default Values for Data Types in Java

By: Baski : 2007-10-13

Description: It's not always necessary to assign a value when a field is declared. Fields that are declared but not initialized will be set to a resonable default by the compiler. Generally speaking, this default will be zero or null, depending on the data type. Relying on such default values, however, is generally considered bad programming style.


150. Data Types in Java

By: Abinaya : 2007-10-13

Description: The Java programming language is strongly-typed, which means that all variables must first be declared before they can be used. This involves stating the variable's type and name, as you've already seen: