lab2
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| lab2 [2017/01/30 13:51] – franck | lab2 [2018/01/02 22:03] (current) – franck | ||
|---|---|---|---|
| Line 15: | 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 27: | 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.1485784264.txt.gz · Last modified: by franck
