Experiment with familiarity with a Java development environment

Source: Internet
Author: User

Beijing Institute of Electronic Technology (besti)

Lab Report

Course: Java Programming class: 1351 Name: School Number: 20135117

Score: Instructor: Lou Jia Peng Experimental Date: 2015.4.16

Experiment level: Preview degree: Experiment time: 16:30-18:30

Instrument Group: Compulsory / elective: Elective experiment number: 1

Lab Name: familiarity with the Java development environment

Experimental purposes and requirements:

1. Students who do not have a Linux base are advised to start with the Linux basics (new version) Vim Editor course

2. Complete the experiment, write the experiment Report, the experiment Report template see QQ Group, pay attention to the experiment report focus is the running result, encounter problem (tool find, install, use, program edit, Debug, run, etc.), solution (empty method such as "Check Network", "Ask classmate", "read book" Equal to 0 points) as well as analysis (what can be learned from it, what gains, lessons, etc.)

3. Report the time of your PSP (Personal software Process)

4. Non-plagiarism

Experimental instrument:

Name

Model

Number

Pc

MacBook Air

1

First, the contents of the experiment

1. Compile and run a simple Java program using JDK

2. Edit, compile, run, and debug Java programs using Eclipse

Second, the experimental steps

(i) Java program Development under command line

1. Open cmd similar to Windows.

2. Enter the CD Code command to enter the code directory.

3. Enter the mkdir 20135117 command to set up the experiment directory and use the dir command to view the established directory.

4. Enter the CD 20135117 command to enter the experimental directory, then enter mkdir EXP1 to create the first experimental directory, and then enter the CD EXP1 into the experiment directory.

5. Enter javac-d. Hello.java command to compile the code, enter the Java HJR. The Hello command runs the program.

(ii) Development and commissioning of Java programs under Eclipse

1. Open Eclipse.

2. In eclipse, click File->new-> Java Project to create new Java projects.

3. Enter the project name HELLOHJR and click the Finish button to complete the new project.

4. In eclipse, click File->new->class to create a new Java class.

5. Enter the package name HJR according to the Java code specification, the class name HELLOHJR, and tick the Automatically generate main function option, and then click the Finish button.

6. Enter the following code:

Package HJR;

public class Hellohjr {

public static void Main (string[] args) {

int i=5;

int j=6;

int Sum=add (I,J);

SYSTEM.OUT.PRINTLN (sum);

sum=0;

for (i=0;i<100;i++)

Sum+=i;

SYSTEM.OUT.PRINTLN (sum);

}

public static int Add (int augend,int addend) {

int sum=augend+addend;

return sum;

}

}

7. Set breakpoints on the program and step into it

8. View the value of a variable in the Variable tab

9. Set conditional breakpoints

(iii) exercises (implemented through the command line and Eclipse two, practicing and debugging programs under Eclipse)--3. Implement the Fibonacci sequence function and test

Experiment Code:

Import java.util.*;

public class Fibonacci {

public static void Main (string[] args) {

int x,i;

System.out.println ("Input the Number:");

Scanner s=new Scanner (system.in);

x =s.nextint ();

Int[] Fibonacci=new int[x];

Fibonacci[0]=1;

Fibonacci[1]=1;

for (i=2;i<x;i++)

{

FIBONACCI[I]=FIBONACCI[I-1]+FIBONACCI[I-2];

}

for (i=0;i<x;i++) {

System.out.print (fibonacci[i]+ "");

}

}

}

Third, the experimental experience

Because this is the first time to do the Java experiment, the program is relatively simple to write. The first two experiments were mostly familiar with the environment of both command line and Eclipse, but found that they were unfamiliar with many instructions when using command lines. The next third content is not difficult, but it takes a while to figure out how to enter values in Java. Overall, this experiment is still relatively smooth, from which I feel to write a program must clarify their own ideas, programming will not rush.

Iv. Results of operation

A

Two

Three

Five, PSP time

Steps

Take

Percentage

Demand analysis

12min

10%

Design

12min

10%

Code implementation

48min

40%

Test

12min

10%

Analysis Summary

36min

30%

Vi. problems encountered

This experiment was mainly related to the virtual machine and some problems.

1, the CMD under window input pwd display is not a useful instruction.

Workaround: This command should be used under the Linux system, when you want to know the current directory, you can use this command to display the entire path name.

2, when the cmd input ls under window is not a useful instruction.

Workaround: This command should be used under the Linux system to view the current directory situation.

Experiment with familiarity with a 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.