原
String dstPath = getRealyPath(getSavePath())+ "\\icon\\" + iconname+iconformat;
系统自动装配
String sep = File.separator;
String dstPath = getRealyPath(getSavePath())+ sep+"icon"+sep + iconname+iconformat;
本文探讨了在文件操作中通过改进路径构造方法提高效率和灵活性的策略,详细介绍了如何使用Java中的字符串拼接和文件路径操作来优化代码实现。
原
String dstPath = getRealyPath(getSavePath())+ "\\icon\\" + iconname+iconformat;
系统自动装配
String sep = File.separator;
String dstPath = getRealyPath(getSavePath())+ sep+"icon"+sep + iconname+iconformat;

被折叠的 条评论
为什么被折叠?