13ajdf39.blog this is what it is. golden tee. i am glad to see the resurgence in the last 5\~ years of actual arcade bars in my area. i think the maintenance on the machines is what will be the factor that ends this trend, however. that was a big problem 20+ years ago at the actual arcades, and that was with techs who knew how to replace them. most bar owners today are not going to have a clue how to fix the wiring to get one back up and running.
| |
. The first line declares a variable named num, but it does not actually contain a primitive value yet. Instead, it contains a pointer (because the type is Integer which is a reference type). Since you have not yet said what to point to, Java sets it to null, which means "I am pointing to nothing". In the second line, the new keyword is used to instantiate (or create) an object of type Integer and the pointer variable num is assigned to that Integer object. The NullPointerException occurs when you declare a variable but did not create an object. So you are pointing to something that does not actually exist. If you attempt to dereference num BEFORE creating the object you get a NullPointerException. In the most trivial cases, the compiler will catch the problem and let you know that "num may not have been initialized," but sometimes you may write code that does not directly create the object. For instance, you may have a method as follows: |
NullPointerExceptions are exceptions that occur when you try to use a reference that points to no location in memory (null) as though it were referencing an object. Calling a method on a null reference or trying to access a field of a null reference will trigger a NullPointerException. These are the most common, but other ways are listed on the NullPointerException javadoc page.
Aucun commentaire:
Enregistrer un commentaire