If I'm doing something like this:
String str = null;
str.toLowerCase();
Here I will have a NullPointerException and I want to know where an exception will be created. Does JVM manage such cases and throws NullPointerException or at compile time there are some checks for that case in com.sun.tools.javac.code.Type class?
I can't find a good article which will explain it to me and I also can't find anything related to Runtime exception throwing in OpenJDK javac sources. Can anyone base explanation or link to book\article where I can read about Runtime exceptions creation?
Answering this part I want to know where an exception will be created ? or Title itself Where does NullPointerException is thrown?
Image Source Oracle.
Answering your this part
or at compile time there are some checks for that case ?
because A checked exceptions. must be caught somewhere in your code. If not code will not compile. That's why they're called checked exceptions.
Since
you will be able to compile without handling any Exceptions, so is not a checked exception (You can look for better formal definition on the web).
By now you know that NullPointerException is not a checked exceptions.
Quoting JSL
These RuntimeException are thrown when these are detected by the methods because it encountered an error in the virtual machine
runtime