lab2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lab2 [2017/01/14 17:21] – franck | lab2 [2018/01/02 22:03] (current) – franck | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Lab 2 ====== | ||
+ | |||
+ | |||
* In your home directory create a directory named .jpf (note that the name of the directory starts with a dot). | * In your home directory create a directory named .jpf (note that the name of the directory starts with a dot). | ||
* In the created directory, create a file named site.properties with the following contents. | * In the created directory, create a file named site.properties with the following contents. | ||
Line 12: | Line 15: | ||
import java.util.Random; | import java.util.Random; | ||
- | public class RandomFraction | + | public class RandomFraction { |
- | { | + | public static void run() { |
- | public static void run() | + | Random random = new Random(System.currentTimeMillis()); |
- | { | + | System.out.println(1 / random.nextInt(1000000)); |
- | Random random = new Random(System.currentTimeMillis()); | + | } |
- | System.out.println(1 / random.nextInt(1000000)); | + | |
- | } | + | |
} | } | ||
</ | </ | ||
Line 24: | Line 25: | ||
* In the created directory lab2, create the class RandomFractionTest with the following content. | * In the created directory lab2, create the class RandomFractionTest with the following content. | ||
<code java> | <code java> | ||
- | public class RandomFractionTest | + | public class RandomFractionTest { |
- | { | + | public static void main(String[] args) { |
- | public static void main(String[] args) | + | RandomFraction.run(); |
- | { | + | } |
- | RandomFraction.run(); | + | |
- | } | + | |
} | } | ||
</ | </ |
lab2.1484414492.txt.gz · Last modified: 2017/01/14 17:21 by franck