【发布时间】:2016-02-08 20:50:51
【问题描述】:
是否可以修改文件路径以使其包含字符串变量?
示例代码
String var = "Picture.jpg";
ImageIcon img = new ImageIcon("C:\\Users\\Main\\Documents\\CompSciProjects\\Memory Game\\var");
【问题讨论】:
-
ImageIcon img = new ImageIcon("C:\\Users\\Main\\Documents\\CompSciProjects\\Memory Game\\" + var); -
天哪,我觉得自己很笨,这里的答案很明显。