First Java Lab report

Source: Internet
Author: User

Beijing Institute of Electronic Technology (BESTI)

Lab Report

Course Name: Java Lab class: 1352 Name: Pan No.: 20135209

Score: Instructor: Lou Jia Peng Experimental Date: 2015.04.14

Experiment level: Preview degree: Experiment time:

Instrument Group: Compulsory/Elective: Elective experiment number: 01

Lab Name: familiarity with the Java development environment

Experimental purposes and requirements:1. Compile with JDK and run a simple Java program.

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

                           ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp    

                           ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp    

Experimental instrument:

Name Model Number
Pc Dell 1

Experimental steps:

(i). command line under Java program development:

1. Open the terminal and enter CD Code,mkdir 20135209 to set up the experiment directory.

2. Enter Gedit Hello.java, edit Hell.java as follows:

3. Enter javac-d. Hello.java Compile the code and enter Java Ph. Hello run the program, the result is as follows:

(ii) Development and commissioning of Java programs under Eclipse

1. On the command line, enter Eclipse command to open Eclipse.

2. New project, package, class Hellojdb.java

3. Enter the code and run the results as follows:

4. Open the Debug view via Windows->open Perspective->debug, as shown in

5. Set breakpoints for debugging with the following results:

(c) Exercise:

5. The solid line 1-n the function of all prime numbers between the integers and is tested.

The code is as follows:

Import Java.util.Scanner;
public class Prime {
public static void Main (string[] args) {
Scanner sc=new Scanner (system.in);
System.out.println ("Input N:");
int N=sc.nextint ();
System.out.println ("Prime is:");
go:for (int i = 2; i < n; i++) {
for (int j = 2; J < I; J + +) {
if (i% j = 0)
Continue go;
}
System.out.print ("" + i);
}
}
}

1. Run in command line:

Run the results in eclipse:

(d) PSP Statistics:

Steps Take Percentage
Demand analysis 2min 10%
Design 3min 14%
Code implementation 5min 24%
Test 3min 14%
Analysis Summary 8min 38%

Problems encountered: Breakpoints are not set at the beginning

How to solve: Observe the experimental steps, examples of the diagram, and eventually find themselves.

Analysis:

Having mastered the method of creating a Java package under a text editor, I initially mastered the method of debugging the program in Eclipse.

It made me realize that there are many more important instructions to learn in the future of Java learning.

First Java Lab report

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.