Your SlideShare is downloading. ×
Java strings
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Java strings

114
views

Published on

Strings …

Strings
StringBuffer
Difference between String and StringBuffer


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
114
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. UNIT - IV Java Strings Pardeep Sharma pardeepsharma727@gmail.com
  • 2. String class • are basically immutable objects in Java. • Immutable means once created, the strings cannot be changed. • Whenever we create strings, it is this class that is instantiated. • In Java strings can be instantiated in two ways: – String str= “You Cannot Change me”; – String str2=new String (“You Cannot Change me”);
  • 3. Java.lang.String • • • • • To create an empty string String str1=new String(); String str2=“You cannot ”+ “Change me”; Char ch[]={‘a’ , ’b’ , ’c’}; String str3=new String(ch); OUTPUT(abc)
  • 4. Common methods of the String class
  • 5. Methods of String class
  • 6. StringBuffer • StringBuffer is the class used for representing changing strings. • StringBuffer offers more performance enhancement whenever we change Strings, because it is this class that is actually used behind the curtain. • Just like any other buffer, StringBuffer also has a capacity and if the capacity is exceeded, then it is automatically made larger. • The initial capacity of StringBuffer can be known by using a method capacity().
  • 7. StringBuffer Constructors
  • 8. Length(); capacity();
  • 9. Thanks