First Test report of experimental building

Source: Internet
Author: User

Beijing Institute of Electronic Technology (besti)

Actual Inspection report

Lesson:Java Programming Class:1353 name : Cambridge King:20135316

Score: Instructor: Lou Jia Peng experimental Date:2015.4.14

Experiment level: Preview degree: Experiment time:21:00~23:00

Instrument Group: Compulsory / elective: Elective Experiment Number:1

Lab Name: familiarity with the JAVA development environment

Experimental purposes and requirements:

1. compile and run a simple Java program using the JDK .

2. edit, compile, run, and debug simple Java programs under command line and Eclipse .

3. Students who do not have a linux Base are advised to start withthelinux Basics (new version)Vim Editor course.

Experimental instrument:

Name

Model

Number

Pc

Lenovo

1

Virtual machines

Laboratory Building

1

First, the experimental steps

1. program development of JAVA under command line

(1) First double-click the Xface terminal icon on the desktop, open the terminal (similar to Windows cmd), and then automatically run Shell program.

(2) Enter the CD Code command into code(Note C to capitalize) directory, enter mkdir 20135316 command to create the experiment directory, you can use the LS command or the dir command to view the established directory situation.

(3) Enter the CD 20135316 command into the experimental directory, then enter mkdir EXP1 to create the first experimental directory, and then enter the CD EXP1 into the experimental directory, you can enter the PWD command to view the current working path.

(4) Enter gedit Hello.java (note Save the code in the exp1 directory ) or Vim Hello.java (it is recommended that you take some time to learn vim Edit the Hello.java and enter the following code:

1 package ljp;2 import java.util.scanner;3 public class  hello{4  Public static void main (String[] args) {5        system.out.println ("Input your first name, please:");6        scanner s = new scanner (system.in);7        String name = s.next (); 8       system.out.println ("Hello   " + name + "  ! "); 9    }10 }

Notice the first line of the code, which affects how we compile the code using JAVAC.
Note the second line of code, when we use the class in the Java class Library, we import the related class with import (which can be temporarily understood as the feature of include in C ) , the import path can be viewed in the JDK Help document, for example, we use the Scanner class, the path is seen in the red box:

(6) Enter javac-d. Hello.java command to compile the code, enter the Java WJQ. The Hello command runs the program as shown in the results:

2. JAVA program development and debugging under Eclipse

(1) Enter the eclipse command at the command line and enter or click the eclipse EE icon on the desktop to open eclipse

(2) in Eclipse , click file->new-> Java Project to create new Java projects. Enter the project name Hellojdb and click the Finish button to complete the new project.

(3) in Eclipse , click file->new->class to create a new Java class.

(4) According to the Java Code Specification input package name WJQ, class name hellojdb, and check the automatic generation of main function Options, and then click Finish button.

(5) Enter the code and click the Run button (or use the ctrl+f11 shortcut)to see theresults of the run in the console.

(6) Debug program. Open the Debug view by clicking Window->open perspective->debug.

(7) set breakpoints and single step operation. To set a conditional breakpoint, right-click on the left side of the accumulation and select breakpoint Properties. Enter a condition, press F8 run to condition stop.

The results of the program run as follows:

3, Exercise: After the study number two to take the remainder -- the title 2: Achieve arithmetic, and test

Run with the command line and Eclipse Two methods (already in the lab building)

The code is as follows:

Ii. problems encountered and their solutions

1, in this experiment, basically mastered linux command line , such as creating a directory (mkdir Span style= "font-family: the song Body;" ), view directory ( ls or dir CD with windows same) and view the current working path ( pwd

2 . Compile a . java file format:javac-d. class name Java Because there is a package in the Java file, so at compile time to D, it is necessary topay attention to D behind that point of the front and back have spaces

3 . Run file format:java package name . class name

4, in the breakpoint gradually running on the operation is not skilled, to follow the teacher step by step, after a few exercises, daring to try their own independent operation, the basic can achieve the basis of the results of the operation.

5, in the process of writing arithmetic code, encountered the problem of operation symbol input, because the operation symbol is a char type,Scanner I only mastered String Input method, found on Baidu on the relevant solution, the successful use of the following code to achieve the input of the operation symbol.

String Str=s.next ();

Char Op=str.charat (0)

Third, the experimental harvest

The first use of the experimental building, virtual machine and Linux Environment , the operation is not very smooth, and the speed is a little slow, the interface font is also very small, a problem will make people anxious, because the teacher gave the steps very detailed, feel that learning these processes is easy and easy. In the face of problems, you can have time to think carefully about the problem, in addition, you can also find help files, see the use of functions, as well as through Baidu, repeated debugging, and finally to achieve the subject of experimental practice. Through this experiment, we learned how to use the Scanner , the use of the package, and the compilation and operation of the package Java files.

First Test report of experimental building

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.