Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What are the common anomalies in Java programming?
What are the common anomalies in Java programming?
In the process of Java programming, we need to write code to run the program, which is done by hand, so there will be many abnormal phenomena, which are normal phenomena, but we need to understand and learn to deal with these abnormal phenomena. Today, I will introduce you to the common exceptions in Java programming. Let's have a look.

Common exceptions in Java:

1, NullPointerException class: nullpointerexception

2. Data type conversion exception: java.lang.ClassCastException

3. No access right: java.lang.illegalaccessexception.

4. Parameter error of method: java.lang.illegalargumentexception.

5. Array subscript out of bounds exception

6. Exception at the end of the file: EOFException

7. No exception was found in the file: FileNotFoundException.

8. The string is converted into a numeric exception: NumberFormatException.

9. The specified class does not exist: java.lang.classnotfoundexception.

10, instantiation exception: java.lang.instantiationexception

How to understand the data type conversion exception in Java?

Exception in data type conversion: java.lang.ClassCastException

This exception is thrown when an attempt is made to convert an object down, but the object can neither be converted to an instance of its subclass, as shown in the following code.

Object obj = new integer (0);

String str = obj

What does the null pointer exception class mean in Java?

Nullpointerexception class: NullPointerException

An uninitialized object or a nonexistent object was called. It often appears in the operations of creating pictures and calling arrays, such as uninitialized pictures or wrong paths when creating pictures. Null pointer in array operation,

In other words, the initialization of array is confused with the initialization of array elements.

The initialization of the array is to allocate the required space for the array, and the elements in the initialized array are still empty without instantiation, so each element needs to be initialized (if it is to be called).

There are many common exceptions in Java. I hope you can know the above 10 in advance, which will help you to process it faster in the actual coding process. Come on!