Java

43
2486 reads

February 22, 2013

For Loop Initialization, Increment Decrement Using Comma


The program below demonstrates the use of comma inside the parenthesis of for loop.

45
2479 reads

February 22, 2013

ForLoop Example


This example demonstrates a for loop.

72
2586 reads

February 22, 2013

Find Primes


The program below demonstrates a test for prime.

351
5128 reads

February 22, 2013

indexOf


These two methods are overloaded in several different ways. In all cases, the methods return the index at which the character or substring was found, or –1 on failure.

97
2586 reads

February 22, 2013

replace()


This method replaces the characters in a substring of this StringBuffer with characters in the specified String.

241
3757 reads

February 22, 2013

Demonstrate delete() and deleteCharAt()


The delete( ) method deletes a sequence of characters from the invoking object.

163
3751 reads

February 22, 2013

Using reverse() to reverse a StringBuffer


This example shows how to reverse the content of the StringBuffer using reverse method of Java StringBuffer class.

383
3706 reads

February 22, 2013

Demonstrate append()


Appends the specified string to this character sequence.

299
4118 reads

February 22, 2013

charAt() and setCharAt()


charAt(int index)

341
4321 reads

February 22, 2013

StringBuffer length vs. capacity


The capacity is the amount of storage available for newly inserted characters, beyond which an allocation will occur.

Obvious length is related to number of characters in string