Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Thursday, August 9, 2012

String In JAVA

Strings

Definition:

Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects.

The Java platform provides the String class to create and manipulate strings.


Creating Strings

The most direct way to create a string is to write:


String greeting = "Hello world!";


Garbage Collector in Java


The Garbage Collector in JAVA

Some object-oriented languages require that you keep track of all the objects you create and that you explicitly destroy them when they are no longer needed. Managing memory explicitly is tedious and error-prone. The Java platform allows you to create as many objects as you want (limited, of course, by what your system can handle), and you don't have to worry about destroying them. The Java runtime environment deletes objects when it determines that they are no longer being used. This process is called garbage collection.