Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program to show an example of modifying String objects

Posted By: Dep Tran     Category: Java     Views: 1720

A Java Program to show an example of modifying String objects.

Code for Program to show an example of modifying String objects in Java

publicclass JAVA_053
 {


    publicstaticvoid main(String[] args)
    {
       String Str="To be or not to be";

       System.out.println("The Original String is : " + Str);

       Str=Str.replace(' ','%');

       System.out.println("The Replaced String is : " + Str);

       Str="             This is a String.   ";

       System.out.println("\nThe Original String is : " + Str);

       Str=Str.trim( );

       System.out.println("The Trimed String is : " + Str);
    }
 }
  
Share: 


Didn't find what you were looking for? Find more on Program to show an example of modifying String objects Or get search suggestion and latest updates.

Dep Tran
Dep Tran author of Program to show an example of modifying String objects is from Thanh Pho Ho Chi Minh, Vietnam.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!