User Tools

Site Tools


lab2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
lab2 [2017/01/30 13:51] francklab2 [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)); +
- }+
 } }
 </code> </code>
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(); +
- }+
 } }
 </code> </code>
lab2.1485784264.txt.gz · Last modified: 2017/01/30 13:51 by franck

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki