User-submitted Java Projects

30
2289 reads

February 8, 2013

Comparing the three values with ternary operator


This example illustrates the implementation of binary and ternary operator.

21
3649 reads

February 8, 2013

Addition without using any arithmetic operator


This example shows that how to add any two integer numbers without using any arithmetic operator.
It implements the logical operator for adding.

139
2419 reads

February 8, 2013

Boolean Operators


The Boolean logical operators are : | , & , ^ , ! , || , && , == , != .

29
1145 reads
34
2449 reads

February 8, 2013

Inheritance - Extending a Class


A class declaration can use the extend keyword on another class, like this: class C extends B { … }.

73
2280 reads

February 8, 2013

Defining and Using Java Class


This example demonstrates how a class is defined and how the getter/setter methods are used.

28
3172 reads

February 8, 2013

Pizza


The program below demonstrates how to instantiate an object.

206
34760 reads

February 8, 2013

Instance variable


A class or object can have it's own variables. In Java, these are called instance variables.

126
2368 reads

February 8, 2013

Local Variable


Local variables can only be referenced and used locally in the method in which they are declared.

1. Local variable lifetime is from method entry to method return.

239
2541 reads

February 8, 2013

Usage of final variable.


A final variable can only be initialized once, either via an initializer or an assignment statement. It does not need to be initialized at the point of declaration