Java Handy Thingys - PowerPoint PPT Presentation

1 / 3
About This Presentation
Title:

Java Handy Thingys

Description:

Random rand; // define a new variable. rand new Random(); // create variable ... Color col; there are different ways to make a color. col = new Color(Color.red) ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 4
Provided by: garyg4
Category:
Tags: col | handy | java | thingys

less

Transcript and Presenter's Notes

Title: Java Handy Thingys


1
Java Handy Thingys
  • Gary Greer

2
Random Numbers
  • import java.util.Random
  • Random rand // define a new variable
  • rand new Random() // create variable
  • Uses time in milliseconds as the seed.
  • x rand.nextInt(8)
  • Returns random integer 0...8

3
Colors
  • Color col
  • there are different ways to make a color
  • col new Color(Color.red)
  • col new Color(21, 220, 255)
  • col new Color (221)
  • see the Java APIs http//java.sun.com/j2se/1.5.0/
    docs/api/index.html
Write a Comment
User Comments (0)
About PowerShow.com