Wednesday, November 10, 2010

String, StringBuffer & stringBuilder in JAVA

1] Differnces between the above three is:
   String is immutable
   StringBuffer & StringBuilders are mutable.

2] Differnces between the StringBuffer& stringBuiler:
   StringBuffer is synchronized.
   StringBuilder is unsynchronized.

3] On which scenario we have to use the above three?
   String: If the text is not going to change use a string Class because a String object is    immutable.
   StringBuffer: If the text can changes, and will be accessed from multiple threads, use a StringBuffer because StringBuffer is synchronous.
   StringBuilder : If the text can change and will only be accessed from a single thread, then use StringBuilder because StringBuilder is unsynchronized.

Sunday, July 4, 2010

Setting the class path to JAVA on Windows XP and 2000

Setting the class path to JAVA on Windows XP &2000

• Open the System Properties window (by right-clicking on My Computer and selecting Properties, or through the Control Panel - Start -> Control Panel -> System).
• On the Advanced tab, click the Environment Variables button.
• In user variables, select the new tab and give the variable name as JAVA_HOME and value as path of the java folder (Example: C:\Java)
• In System variables we have to set the CLASSPATH; if it is already exists then add the java path up o lib folder (Example C:\Java\lib)