|
Class Hello
{
public static void Main (string[] args)
{
System.out.println ("Hello java");
}
}
3. If you enter in the DOS commandin question 2:java Hello
The following results appear: Bad command or the file name
What could be the reason? Please explain why.
|
The JDK may not have been successfully installed , or the environment variable has not been configured, or the corresponding file has not been compiled. |
4. If you enter in the DOS commandin question 2:java Hello
The following results appear: Exception in thread "main" Java.lang.NoClassDefFoundError:Hello
What could be the reason? Please explain why.
|
There may be no defined class directly written into main 's bytecode. |
5. in question 4 , under the Hello.class path,
input command:java hello.class, what will happen, why?
|
Result: Error message: The main class Hello.classcould not be found or could not be loaded. |
|
Because java Hello is already loading class, no need to add the following class . |
6. describe the difference between the basic data type and the reference data type?
|
1. Basic type values are stored directly in the stack memory
2. The value of the reference type is stored in the heap memory, the address is stored in the stack memory
3. The reference type assigns the address to the new variable when the value is assigned
4. Assign to a new variable when the base type is assigned |
7. What are the main types of files in Java? What are the respective roles?
|
. class type, generated after compilation by source code
. Java Type, source code
. jar Type, formed by the compression of several related. class files for ease of use and delivery |
|