Write code to Place a prefix on the filename.
//package com.book2s; public class Main { public static void main(String[] argv) { String path = "book2s.com"; String prefix = "book2s.com"; System.out.println(prefixFilename(path, prefix)); }//from w w w. j a v a2s . c o m /** * Places a prefix on the filename. * <br><br> * Note: Only works for windows style paths. */ public static String prefixFilename(String path, String prefix) { int index = path.lastIndexOf("\\"); return (path.substring(0, index) + "\\" + prefix + path .substring(index + 1)); } }