Java

22
2309 reads

February 14, 2013

break & continue


Working with loops, often we require use of continue & break keywords. This example illustrates their use.

23
2413 reads

February 14, 2013

Loops


There may be a situation when we need to execute a block of code several number of times, and is often referred to as a loop.

130
2284 reads

February 14, 2013

proper use of visibility in classes


Demo class with Person to show proper usage of visibility and restrictions.

190
3672 reads

February 13, 2013

visibility of variables


demonstrates how visibility of variables are important

327
5245 reads

February 13, 2013

Visibility of methods


This shows the visibility of methods from different classes.

381
5175 reads

February 13, 2013

While loop


This example illustrates that how to initialize a while() loop and where to put the testing-condition
and increment/decrement the value.
As:

initialization;
while(testing-condition){

138
2643 reads

February 13, 2013

For loop


This example illustrates that how to initialize and terminate the loop.
As:
for(initialization; terminating condition; increment or decrement){
Body
}

53
2269 reads

February 13, 2013

String comparison methods


This program illusrates the use of Strings & related methods.
Method used in line 18 is:
boolean regionMatches(int startIndex, String str2,int str2StartIndex,int numChars)

59
2276 reads

February 13, 2013

StringBuffer and related methods


This program shows the use of String Buffer and all its related methods.

59
2290 reads

February 13, 2013

Use of toString()


This example demonstrates the use of toString() method. Here Box's toString() method is automatically invoked when a Box object is used in a concatenation expression or in a call to println().