This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Race { | |
private static boolean raceFinished = false; | |
private static String winner; | |
public static void main(String[] args) throws InterruptedException { | |
Thread[] players = new Thread[10]; | |
// Fill the array | |
for (int i = 0; i < players.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package]>java.util.* | |
Random | |
>Methods: | |
nextInt(); | |
nextFloat(); // etc ... | |
GregorianCalendar | |
>Methods: | |
calendar.get(constant); | |
calendar.setTimeInMillis(long); | |
calendar.setTime(Date); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int parseInt(char[] charArray) { | |
int sum = 0; | |
for (char c : charArray) { | |
sum = (sum * 10) + (c - '0'); | |
} | |
return sum; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.animation.*; | |
import javafx.beans.property.*; | |
import javafx.scene.layout.*; | |
import javafx.scene.paint.*; | |
import javafx.scene.shape.*; | |
import javafx.util.*; | |
public class BallPane extends Pane { | |
public final double radius = 20; | |
private double x = radius, y = radius; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.animation.*; | |
import javafx.beans.property.*; | |
import javafx.scene.layout.*; | |
import javafx.scene.paint.*; | |
import javafx.scene.shape.*; | |
import javafx.util.*; | |
public class BallPane extends Pane { | |
public final double radius = 20; | |
private double x = radius, y = radius; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.*; | |
import javafx.event.*; | |
import javafx.scene.*; | |
import javafx.scene.input.*; | |
import javafx.stage.*; | |
public class BounceBallControl extends Application { | |
/** | |
* The main method is only needed for the IDE with limited | |
* JavaFX support. Not needed for running from the command line. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.*; | |
import javafx.event.*; | |
import javafx.scene.*; | |
import javafx.scene.input.*; | |
import javafx.stage.*; | |
public class BounceBallControl extends Application { | |
/** | |
* The main method is only needed for the IDE with limited | |
* JavaFX support. Not needed for running from the command line. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.*; | |
import javafx.event.*; | |
import javafx.scene.*; | |
import javafx.scene.input.*; | |
import javafx.stage.*; | |
public class BounceBallControl extends Application { | |
/** | |
* The main method is only needed for the IDE with limited | |
* JavaFX support. Not needed for running from the command line. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Junit; | |
import javafx.application.*; | |
import javafx.scene.*; | |
import javafx.scene.layout.*; | |
import javafx.scene.paint.*; | |
import javafx.scene.shape.*; | |
import javafx.stage.*; | |
public class AlwaysRectangle extends Application { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |