Java Course Experiment Report experiment a familiarity with the Java development environment

Source: Internet
Author: User

Beijing Institute of Electronic Technology (BESTI)

Real Inspection report

Course: Java Programming Class: 1353 Name: Han Yuqi No.: 20135317

Score: Instructor: Lou Jia Peng Experimental Date: 2015.4.11

Experiment level: Preview degree: Experiment time: 19:30~21:50

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 with the Linux 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 icon on the desktop Xface终端 to open the terminal (like cmd under Windows) and then run the shell program automatically.

(2) Enter cd Code the command into code (note C to capitalize) directory, enter the mkdir 20135317 command to establish the experimental directory, you can use ls the command or dir command to view the established directory situation.

(3) Enter the cd 20135317 command into the experimental directory, and then enter the mkdir exp1 first experimental directory, and then enter cd exp1 into the experiment directory, you can enter the pwd command to view the current working path.

(4) Input gedit Hello.java ( Note to save the code in the EXP1 directory ) or vim Hello.java (it is recommended that you take some time to learn vim) edit Hello.java, and enter the following code:

  1. 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 in the second line of code, when we use the class in the Java class Library to import the related classes with import (which can be temporarily understood as features in the C language), the import path can view the JDK Help documentation, for example, we used the scanner class, The path is shown in the red box:

(6) Enter the javac -d . Hello.java command to compile the code, enter the java hyq.Hello command to run the program results as shown: (This is the only picture I cut out, should be noted later)

2. Java program development and debugging under Eclipse

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

(2) in Eclipse, click File->New-> Java Project New Java Project. Enter project name HelloJDB , and click Finish button to complete the new project.

(3) in Eclipse, click File->New->Class new Java class.

(4) According to the Java Code specification, enter the package name HyQ, the class name HelloJDB , and tick the Automatically generate main function option, and then click the Finish button.

(5) Enter the code and click the Run button (or use the Ctrl+F11 shortcut key) to see the results of the run in the console.

(6) Debug program. Window->Open Perspective->Debug Open Debug View by clicking.

(7) Set breakpoints and single step operation. Set a conditional breakpoint, right-click on the left side of the accumulation, and selectBreakpoint Properties.输入条件,按F8运行到条件停止。

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

(1) After downloading the code:

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

Attached: Code

Ii. problems encountered and their solutions

1, the Linux command line operation is not proficient.

(1) In this experiment, you basically mastered the use of creating a directory (mkdir), viewing the directory (ls or dir), entering the directory (CD is the same as Windows), and viewing the current working path (PWD).

(2) Compile a. java file format: javac-d. Class name. Java (note: There are spaces before and after that point in D)

(3) Run file format: Java package name. Class Name

2, in Eclipse entered the teacher gave the code has been unable to compile successfully, repeatedly check, found that in the creation of the package when the automatic generation of the main function, and I write the code when I hit a lot of curly braces, resulting in the error can not be compiled.

3, because the experimental building virtual machine interface is particularly small, slow speed, unresponsive, I insert breakpoints in eclipse while the guide to the front of each line in the shadow area inserted, but did not see that the breakpoint has been successfully inserted, and then there are not know a few breakpoints and some I did not see what is the thing, The result is simply unable to debug, a press debug in the debug in a bunch of inexplicable things, variable also does not show the value of the variable. Then the card dies here. I refreshed it again, then reopened the eclipse and knocked the code out, ran successfully, inserted the breakpoint to debug successfully, and the conditional breakpoint succeeded.

4, because of the speed problem, I put the last experimental steps of the code to knock on their own computer and then copy and paste the past. Since the use of the experimental building copy and paste is not familiar with, repeatedly sticky many times, success.

Third, the experimental analysis

1. My PSP Time

Steps Time Consuming percentage
Demand analysis 5 10%
Design 5 10%
Code implementation 10 20%
Test 15 30%
Analysis Summary 15 30%

2. Personal Impressions

This experiment was the first time I used a lab building, a virtual machine, and a Linux environment. This environment feeling time is very tight, the internet is not very good, the interface font is also very small, a problem will make people anxious, but the more urgent the more do not come out, or to focus on the analysis of the problem.

The teacher gave the steps very detailed, let me feel learning these new things rule. Although learning ability is very important, but for a new thing, before a large part of the time is to imitate and learn from, spend time and energy to seriously study, oneself can achieve the level of use freely, finally have the ability.

I encountered a lot of problems can be solved by their own, for Java learning I just started, a lot of things know but not to use, class should also be installed on the computer virtual machine, self-learning Linux basic operation, strengthen the practice.

Java Course Experiment Report experiment a familiarity with the Java development environment

Related Article

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.