Java Tutorials
151. java.lang.NoClassDefFoundError and java.lang.NoSuchMethodError in UNIX
By: Yolander : 2007-10-13
Description: One of the places java tries to find your bytecode file is your current directory. So, for example, if your bytecode file is in /home/jdoe/java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Return:
152. The switch Statement example in Java
By: Kamini : 2007-10-13
Description: Unlike if-then and if-then-else, the switch statement allows for any number of possible execution paths. A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types and a few special classes that "wrap" certain primitive types: Character, Byte, Short, and Integer.
153. while and do-while example in Java
By: Lakshmi : 2007-10-13
Description: The while statement evaluates expression, which must return a boolean value. If the expression evaluates to true, the while statement executes the statement(s) in the while block. The while statement continues testing the expression and executing its block until the expression evaluates to false. Using the while statement to print the values from 1 through 10 can be accomplished as in the following WhileDemo program:
154. for loop example in Java
By: Manoj Kumar : 2007-10-13
Description: The for statement provides a compact way to iterate over a range of values. Programmers often refer to it as the "for loop" because of the way in which it repeatedly loops until a particular condition is satisfied. The general form of the for statement can be expressed as follows:
155. The break Statement example in Java
By: Norman Chap : 2007-10-13
Description: The break statement has two forms: labeled and unlabeled. You saw the unlabeled form in the previous discussion of the switch statement. You can also use an unlabeled break to terminate a for, while, or do-while loop, as shown in the following BreakDemo program:
156. this keyword sample in Java
By: Reema Sen : 2007-10-13
Description: Within an instance method or a constructor, this is a reference to the current object - the object whose method or constructor is being called. You can refer to any member of the current object from within an instance method or a constructor by using this.
157. public, private, protected modifiers in Java
By: Sri Ganesh : 2007-10-13
Description: A class may be declared with the modifier public, in which case that class is visible to all classes everywhere. If a class has no modifier (the default, also known as package-private), it is visible only within its own package (packages are named groups of related classes)
158. Inner Class Example in Java
By: Tamil Selvan : 2007-10-13
Description: To see an inner class in use, consider a simple stack of integers. Stacks, which are a common data structure in programming, are well-named they are like a "stack" of dishes. When you add a dish to the stack, you put it on top; when you remove one, you remove it from the top. The acronym for this is LIFO (last in, first out). Dishes on the bottom of the stack may stay there quite a long time while the upper dishes come and go.
159. interface Example in Java
By: Vimala : 2007-10-13
Description: In the Java programming language, an interface is a reference type, similar to a class, that can contain only constants, method signatures, and nested types. There are no method bodies. Interfaces cannot be instantiated-they can only be implemented by classes or extended by other interfaces. Extension is discussed later in this lesson.
160. Inheritance Example in Java
By: Watson : 2007-10-13
Description: Here is the sample code for a possible implementation of a Bicycle class and demonstrates the concept of Inheritance in JAVA.