class Test5_7
{  
	public static void main(String[] args)
     	{   
		String path="d:\\doc\\ example.doc";
        	int index=path.lastIndexOf("\\");
        	String oldName=path.substring(index+1);
        	String newName=oldName.replaceAll(".doc",".java");
        	System.out.println(path);
        	System.out.println(oldName);
        	System.out.println(newName); 
      	}
}
