Some common problems in Java programming

xiaoxiao2021-03-06  41

Question 1: The compiler can not find the class.

Solution:

Make sure you have imported classes or its packages. If you have setup to the ClassPath environment variable, you want to reset. Ensure that the spelling of the class name is the same as the definition, pay attention to the case. If the class is in the package, make sure they are in the correct subdirectory. At the same time, some programmers use different names from .java file names. To make sure you are using class names instead of file names. In fact, this error will not appear in the same name and file name.

Question 2: The comment cannot find one of the classes

Solution:

Make sure you specify the class name instead of the class name. If you have setup to the ClassPath environment variable, you want to reset. If the class is in the package, make sure they are in the correct subdirectory. Make sure you call this comment from the directory where the .CLASS file is located.

Question 3: Can the program do not work? What did you have?

The following is a public error of Java newbie, pay attention to the following:

Do you forget every CASE statement in the Switch statement to use Break? Are you using the assignment operator when you should use the comparative operation symbol ==? Is the termination condition in the loop statement correct? Make sure you are not too early or too late to terminate the loop. That is to say, make sure the or> = A operator is used correctly. Remember that the index of the array is starting from 0, so the cycle of the array should be: for (int i = 0; I and <) operators are more suitable in the logic of floating point numbers. Do you understand the encapsulation, inheritance or other object-oriented programming and design concepts? Make sure the statement block is in the middle of the braces {and}. The following code block seems to be right because it uses indentation writing, but you look at it carefully {}: for (INT i = 0; i 转载请注明原文地址:https://www.9cbs.com/read-52674.html


New Post(0)