1 ... "Expected"
This error occurs when something is missing from the code. Usually because of the lack of semicolons or closing parentheses.
Usually, this error message does not indicate the exact location of the problem. In order to find the error, please make sure that all the left brackets have corresponding right brackets.
Before looking at the Java code, look at the instruction line of the code. This eJava software error was not noticed by the compiler until it was examined in depth in the code.
Sometimes a character, such as the left parenthesis, should not be placed in the original position of Java code. So the developer didn't stop the closing parenthesis to balance the parenthesis.
2. "Unclosed string text
If there are no quotation marks at the end of the string text, an error message of "Unclosed String Text" will be created and displayed on the same line as the error. Text is usually the source code of a value. This happens when the string is not extended with quotation marks. This can be easily corrected by adding the required quotation marks and closing the string text.
The string literal is extended by multiple lines. Long strings can be decomposed into string literals with a plus sign ("+"). . Quotes that are part of string literals are not escaped by backslashes ("").
3. "Illegal expression begins.
There are many reasons for the error of "illegal beginning of expression". Therefore, it is listed as one of the less useful error messages. Some developers even think that this is caused by bad code.
. Usually, expressions are created to generate new values or assign values to variables. The compiler expected to find the expression, but the expression was not found because the syntax was not as expected. This error can be found in these statements.
4. "Symbol not found"
All identifiers in Java need to be declared before use. The reason for the error is that when compiling the code, the compiler does not understand the meaning of the identifier.
There are many reasons why you may receive the message "Symbol not found":
When using an identifier declaration in code, its spelling may be different.
Variables have never been declared. Variables are not in the same scope as declarations, and the class has not been imported.
5. "The public class XXX should be in the file.
When the XXX class and the Java program file name do not match, the message "Public class XXX should be in the file" will appear. Only when the class is the same as the Java file will the code be compiled. Classes and files have the same name. Please make sure that the two names are the same.
6. "Incompatible types
Incompatible types refer to logical errors that occur when statements try to pair variables with type expressions. It usually happens when code tries to convert a text string into an integer, and vice versa. This is not a Java syntax error.
When the compiler gives a message of "type incompatibility", it is not easy to fix it. Some functions can convert types. Developers may need to change the expected functionality of the code.
7. "Invalid method declaration; Return type required
This Java software error message indicates the return type of a method that is not explicitly stated in the method signature.
There are several ways to trigger the nalid method.
Declaration; Expected to return type "Error:. Forgot the declaration type.
If the method does not return a value, you need to declare "void" as the type in the method signature.
The constructor name does not need to declare a type. However, if there is an error in the constructor name, the compiler will treat the constructor as an untyped method.
8. "Method & ltX> in class & ltY> cannot be applied to a given type.
It clarifies that the method signature is adjusting the wrong parameters. The called method requires some parameters defined in the method declaration. Check the method declarations and call them carefully to ensure that they are compatible.
9. "Missing Return Statement"
When the method does not return a statement, the message "MissingReturn Statement" will appear. Every method that returns a value (not of void type) must have a statement to return the value directly, so that it can be called outside the method.
There are several reasons why the compiler throws the message "Return statement is missing": the return statement was omitted by dry error.
The method did not return a value, but the void type was not declared in the method signature.
10. "Accuracy may be lost.
When more information is allocated to a variable than its capacity, the message "Precision may be lost" will appear. If this happens, the debris will be thrown away. If this is not important, then the code needs to declare the variable display as a new type. When trying to assign real numbers to variables of integer data type and trying to assign double precision numbers to variables of integer data type, "possible precision loss" usually occurs.