Exercise 1 and Answers

Source: Internet
Author: User
Tags netbeans

1-1 briefly describe the English full name and meaning of JDK, JRE and JVM.

Answer: 1, JDK (Java Development kit) is Java development package;

Jre-java Runtime Environment(Javaoperating environment, abbreviationJRE), is runningJAVAA collection of environments that a program must have, includingJVMStandard Implementation andJavaCore Class Library.

Jvm:java Virtual Machine is the Java vm. (This English full name is not given in the textbook, but in Figure 1-1.) )

1-2 briefly describe the characteristics of the Java language.

Object-oriented, robust and secure, portable, high-performance, and so on.


1-3 Configure the JDK and run the following application:
Public class test{
Public static void Main (Stirng [] args) {
System.out.println ("This is a Test");
   }
}

configuration: If you are in Windows2000 and above, you need to right-click My computer on the desktop and choose Properties, pop up a window called System features, select Advanced, and then choose environment variables, in the environment variable. window to edit the variable path, the value is set to the bin subdirectory of the JDK installation path.
 
1-4 Download integrated development tools such as Eclipse, NetBeans, or JCreator and compile and run a Java program in the development tool.

Please refer to the textbook Appendix I: Use of various development tools

1 ,jcreator

below toJCreator 4.0 Profor an example, the use of this lightweight tool is described. JCreatornot withJDK, so readers need to first installJDK. First time to startJCreatorwhen theJCreatorwill automatically search theJDKinstallation path and prompts you to enter theJDKthe directory for the Help document. IfJCreatorno search toJDKthe installation path that can be used in the menuconfiure->options->jdk ProfilesNext Create aJDKconfiguration. The following figure isJCreatorthe appearance of the interface.

< /c17>

in Span lang= "en-US" >jcreator the JCreator java file. Open the file->new->file menu, select" java Class

ClickFinishbutton to enter the editing interface. JCreatorThe Code hints feature done pretty well we're in classMyfirsttype Letters inm, a drop-down list will appear, one of which isMainmethod, select it to automatically generate aMainmethod. as shown in the following figure.

Select build->compile File compile source file; build->execute File executes the code. The result of the output is in the output panel below the interface.

2 ,Eclipse

Eclipse is a free, open-source, large development tool. Readers can Download the software for free and download the Chinese www.Eclipse.org interface and help document. Eclipse does not need to be installed and can be used after decompression. The directory that prompts the item to be saved at startup, as shown in the following illustration:

after entering the interface, select "File"- > "New"- > The Project menu, enter the name of the project, and you can select the appropriate JDK , as shown in the following illustration:

Click" Finish ", Back to eclipse main interface, select "File"- > >, < Font face= "Times New Roman" >main

Enter the editing interface:

run time Select "Run"- > the Run . .. menu, select the newly created project name in the project where you run the dialog box:

Configuration complete, back to the main interface, click on the toolbar button to run the program.

3 ,NetBeans

NetBeans is SUN developed by the company JAVA development platform. It can be downloaded for free on SUN 's website. Its use is similar to that of other IDE tools, usually by building a project and then creating a class to run it. The following figure is The main interface of NetBeans.


What is the difference between 1-5 application and the way applets are run?
application is a stand-alone program with main function main, and the main method serves as the portal for the JVM to invoke the program. The applet is a GUI program that cannot run independently and needs to be embedded in the browser to run, but programmers can run applets using the Appletviewer command when debugging.
1-6 Compile the following program and explain the reason for the compilation error.
Public class test{
}
Public static void Main (Stirng [] args) {
System.out.println ("This is a Test");
}
The Main method can only be placed in a class, so the method (function) is the same.
1-7 Compile the following program and explain the reason for the compilation error.
Public class test{
System.out.println ("This is a Test");
}
The statement must be placed in a statement block, in general, where the statement is placed in the method, except for the member variable definition statements of the class.
What is the extension of the source file for the 1-8 Java program? What are the extension names for the class file?
It's a simple one, Java and class, respectively.
1-9 Write a program to display on the screen:
*************************************
your name, your school number.
*************************************
This is also very simple, to write three print statements on it.
1-10 How does the presence of virtual machines help with the portability of Java programs?

The presence of Java virtual machines is a portable foundation.



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.