A lab report on Java experiments

Source: Internet
Author: User

Experiment with familiarity with a Java development environment

Experimental content

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

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

Experimental requirements

1. students who do not have a linux Base are advised to first learn the basics ofLinux (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, encountered problems ( tool Find, installation, use, program editing , commissioning, operation, etc. ), solutions (empty methods such as " Check the network "," ask Classmates " ," reading " and so on all get 0 ) and analysis (from which you can get what revelation, what harvest, lessons, etc.);

3. in the lab report, Count your PSP (Personal software Process) time:

Steps

Take

Percentage

Demand analysis

13 minutes

21%

Design

18 minutes

30%

Code implementation

25 minutes

41%

Test

5 minutes

8%

Analysis Summary

61 minutes

4. copying is strictly prohibited.

Experimental knowledge points

1. Installation location and difference of JVM,JRE,JDK ;

2. command line run javac;java;javac-cp; java-cp;

3. Path,classpath,sourcepath setting method and application;

4. Package Management: Packages;import;javac-d ;

5. Eclipse (Netbeans) manages Java projects, debugging: breakpoints, stepping, etc.;

6. Java Basic syntax: type and type conversion; variables; operators; Process control, etc.;

7. use of the JDK help documentation.

Experimental steps

(i) under the command line Java Program Development

    1. (It is recommended that you take some time to study vim) to edit Hello.java and enter the following code:
    2. 1 package LJP;
    3. 2 Import Java.util.Scanner;
    4. 3 public class hello{
    5. 4 public static void main (string[] args) {
    6. 5 System.out.println ("Input your first name, please:");
    7. 6 Scanner s = new Scanner (system.in);
    8. 7 String name = S.next ();
    9. 8 System.out.println ("Hello" + name + "!");



(ii) Eclipse under Java program development, commissioning

    1. Open Eclipse,
    2. Enter the following code:
      1 package LJP;
      2 public class Hellojdb {
      3 public static void main (string[] args) {
      4 int i = 5;
      5 int j = 6;
      6 int sum = Add (i, j);
      7 System.out.println (sum);
      8
      9 sum = 0;
      Ten for (i=0; i<; i++)
      sum + = i;
      12
      SYSTEM.OUT.PRINTLN (sum);
      14}
      15
      public static int Add (int augend, int addend) {
      sum int = augend + addend;
      return sum;
      19}
      20}

```

3, Debug Program

Set breakpoints

(iii) exercise (via command line and Eclipse two ways to achieve, the number of their own after the two and the total number of questions to take the results of the remainder plus 1 is the number of the problem you want to complete, Eclipse the next exercise to debug the program)

3. Implement the Fibonacci sequence function and test.

Background knowledge

The Fibonacci sequence refers to a sequence of 1, 1, 2, 3, 5, 8, 13, 21, 34 ...

0 is the No. 0 item, not the first.

This sequence starts with the second item and each item is equal to the sum of the first two items.

Design ideas

since the Fibonacci sequence is infinite, it is decided to implement the sequence function with the first 10 numbers as an example.

First think of creating an array and then adding loops to the result into the array

Run results

Resources

1. "Eclipse Essence"
2. "Java Language Debugging Technology"
3. The art of software commissioning (electronic version)
4. The law of Construction (electronic version), author Xin Zou Blog

A lab report on Java experiments

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.