0

enter image description here

My markers say my code doesn't compile because the file path is obviously not correct if I run the project on another computer. Let's forget about the solution, I know what it is.

Is this true ? Is this error a run time or compile time error and does the code compile or not

Exception in thread "main" java.io.FileNotFoundException: C:\path\to\hamlet.xml (The system cannot find the path specified)

1 Answers1

0

Of course this is run time error; at compile time it can not go and check whether the file located at right place or not. You hard coded that file path in code instead of that some other person put some variable also that value enter run time and it go for reading that file. At compile time compiler only checks for a syntax error.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Prit
  • 1
  • 1