【发布时间】:2020-04-24 13:56:58
【问题描述】:
尝试注册新用户并且登录部分仅在注册时遇到问题。它说非法转义字符但运行成功
package register;
import java.io.File;
import java.io.IOException;
public class Register {
public static void main(String[] args)
{
try{
File newUser = new File ("C:\Users\Rohani\Desktop\Filehandling\newUser.txt"); //theres an error saying illegal escape char
if (newUser.createNewFile()){
System.out.println("User created: " + newUser.getName());
}else{
System.out.println("User already exist.");
}
} catch(IOException e ){
System.out.println("An error has occured.");
}
}
【问题讨论】: