Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 17th, 2012  |  syntax: Java  |  size: 0.54 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class nino1 {
  5.        
  6. public static void main (String args []) {
  7.        
  8.      @SuppressWarnings("resource")
  9.         Scanner input = new Scanner(System.in);
  10.        
  11.          
  12.          System.err.println("Usage: java StringReplacement [string]\ne.g.: java StringReplacement Michael");
  13.        
  14.      
  15.       System.out.println("Enter your name  ");
  16.       String str = input.next();
  17.            
  18.      
  19.       str = str.replace(str.subSequence(str.length() - 2, str.length()), "em");
  20.       System.out.println(str);
  21.      
  22.      
  23.    }
  24. }