Some problems in Java beginners

Source: Internet
Author: User

1. What is the role of the environment variable path and java_home when configuring the JDK?

Role: tells the operating system where the compiler runs the path and the generated classpath. This allows the Java source program to compile and run.

The following 4-7 questions should be compiled and run in the JDK environment.

2. use a text editor to enter the Hello.java in the classroom and compile and runit in a JDK environment. Please fill in the following box with the result of compiling and running the program.

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

Some problems in Java beginners

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.