Beijing Institute of Electronic Technology (BESTI)
Lab Report
Course: Java class: 1352 name: Jing Mengxin No.: 20135218
Score: Instructor: Lou Jia Peng Experimental Date: 2015.4.17
Experiment level: Preview degree: Experiment time: 15:30~18:00
Instrument Group: 18 Compulsory/elective: Elective experiment number: 01
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 Java programs using Eclipse
Experimental instrument:
Name |
Model |
Number |
Computer |
Dell |
1 |
|
|
|
Statistics for PSP (Personal software Process) time
Steps |
Time-consuming (min) |
Percentage |
Demand analysis |
5~10 |
10% |
Design |
10~20 |
25% |
Code implementation |
20~25 |
35% |
Test |
5~10 |
10% |
Analysis Summary |
10~15 |
20% |
Experimental steps:
(i) Java program Development under command line
Enter the mkdir 20135218 command to set up the experiment directory.
You can use the LS command or the dir command to view the established directory situation.
Enter the CD 20135218 command into the experiment directory, enter a similar mkdir EXP1 to create the first experiment directory, and then enter the CD EXP1 into the experiment directory, you can enter the PWD command to view the current working path.
Enter Gedit Hello.java (note Save the code in the EXP1 directory) to edit the Hello.java and enter the code.
(ii) Development and commissioning of Java programs under Eclipse
Create a new Java Project,package,class, then start writing the code and run the following results:
debugger, set breakpoint on line 4th, Debug F11, step Run F6, run to line 5th
Set the breakpoint on line 11th and click the Resume icon (shortcut F8), and the program runs to line 11th.
To set a conditional breakpoint, right-click on the left side of line 11th and select Breakpoint Properties ...
Set condition "I==50"
Click F8 to see the value of I is 50.
(iii) Exercise (through the command line and Eclipse two ways to achieve, their number after the two and the total number of questions and the result of the remainder of the results plus 1 is the number of their own to complete the title, Under Eclipse Practice debugging Program)
4. Achieve student performance management function, and test.
Implementing the Fibonacci Sequence
Import Java.util.Scanner;
public class fi{
public static void Main (string[] args) {
int i=1,j=1;
SYSTEM.OUT.PRINTLN ("Input a int number:");
Scanner in=new Scanner (system.in);
int In1=in.nextint ();
for (int n=1;n<=in1;n++)
{
System.out.println ("+i+" "+j");
i= (int) (I+J);
j= (int) (I+J);
}
System.out.println ();
}
}
Implemented under Eclipse:
Implemented at the command line:
Third, the experimental experience:
(a) Notes:
1. Running the command line under WIN8, there are many differences between executing statements and Linux. Therefore, in the constant adjustment and learning to find WIN8 command line execution statement usage habits.
2. Compile and run:
Gedit can open compiler to compile
3. when there is a package, the format of the command line:
Compile: javac-d. Xxxx.java d after space, Dot, and then space
Run: Add the package name to the front: Java yyy. xxx, where yyy is the package name, XXX is the class name. That
Note: When you have a package in your code, you must add the- d parameter when you compile your code with JAVAC, and you must prefix the name of the packet when you run the code.
5.eclipse, How to set a breakpoint, how to Single-step debugging, F5 is inside the function, F6 is directly after the function is executed, directly to the next breakpoint is RESUME,F8. Conditional breakpoints are set in the Variable tab, right-click to select Breakpoint Properties ..., then set the conditions.
(ii) problems encountered and solutions
The code is compiled with the package, plus the-D function, but the compilation fails because the use of whitespace is ignored. Later, after careful observation, it was able to run smoothly.
Four: summary
Through this experiment, I had a deeper understanding of Java usage under Windows, and I was more proficient in the operation and use of Eclipse.
I hope that the next time you can use the other system environment for Java program compilation and debugging.
Experiment with familiarity with a Java development environment