daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class StringMutation
  2. {
  3.  
  4.    public static void main (String[] args)
  5.    {
  6.   String phrase = "Change is inevitable";
  7.   String mutation1, mutation2, mutation3, mutation4;
  8.  
  9.   System.out.println ("Original string: "" + phrase + """);
  10.   System.out.println ("Length of string: " + phrase.length());
  11.  
  12.   mutation1 = phrase.concat (", except from vending machines.");
  13.   mutation2 = mutation1.toUpperCase();
  14.   mutation3 = mutation2.replace ('E', 'X');
  15.   mutation4 = mutation3.substring (3, 30);
  16.  
  17.   // Print each mutated string
  18.   System.out.println ("Mutation #1: " + mutation1);
  19.   System.out.println ("Mutation #2: " + mutation2);
  20.   System.out.println ("Mutation #3: " + mutation3);
  21.   System.out.println ("Mutation #4: " + mutation4);
  22.  
  23.   System.out.println ("Mutated length: " + mutation4.length());
  24.    }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top