Experiment Ⅰ ——getting familiar with JDK (Linux + Eclipse)
Content
1.Compile and run easy Java programs using JDK;
2.Edit, compile, run and debug in Eclipse.
Steps
Java in the terminal:
Running in the Idea:
Debug:
View variables at breakpoint:
Step into:
Step over:
Set breakpoint:
Problem & Solution
The demand is easy, while I had no idea about the way of encapsulation for the lack of experience. Our aim is to calculate all the prime from 1 to N, so it should be written as a method. So I new a class called 'Prime'. When I initialise the variable in the class, it turned out error. The assistant professor told me that all the operations should be written in Constructor or Method. Then I put the initialization in the Constructor. Problem solved!
step | time | percentage |
---|---|---|
demand analyse | 0 | 0% |
design | 20min | 30.76% |
code | 20min | 30.76% |
test | 20min | 30.76% |
summarize | 5min | 7.69% |
PS : code