Write code to Place a post fix on a filename just before the extension dot.
//package com.book2s; public class Main { public static void main(String[] argv) { String filename = "book2s.com"; String postfix = "book2s.com"; System.out.println(postfixFilename(filename, postfix)); }// ww w . j a v a 2s.co m /** * Places a post fix on a filename just before the extension dot. */ public static String postfixFilename(String filename, String postfix) { int index = filename.lastIndexOf("."); return (filename.substring(0, index) + postfix + filename .substring(index)); } }