Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

select word from list

import java.util.Random;

public class Selection
{    
  	public static void main(String[] args)    
    {       
        Random rand = new Random(); 
      	String[] animals = {"Dog", "Cat", "Fish", "Turtle", "Penguin"}; // array of animals
      	System.out.println("Console picked " + animals[rand.nextInt(animals.length)]); // prints the random animal selected from array
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: What is a point class in java? 
Java :: setbounds in java 
Java :: rps java 
Java :: turn ascii into text javascriot 
Java :: java remove duplicates from list by property 
Java :: java localtime format 
Java :: java convert integer to string 
Java :: java int to string 
Java :: iterating over a hashmap 
Java :: Java String to ByteBuffer conversion 
Java :: java calendar hour vs hour of day 
Java :: java print hex format 
Java :: how to change image resolution in android programmatically 
Java :: Fast Lookup of Java 
Java :: groovy ternary operator short form 
Java :: key listener java 
Java :: java jframe actionlistener 
Java :: java check if enum contains value 
Java :: javafx stackpane set position 
Java :: public String toString() { 
Java :: get request java 
Java :: how to acces every char of a String in java 
Java :: check if number is odd java 
Java :: java format use same value multiple times 
Java :: get input in java using joptionpane 
Java :: java loop 
Java :: Java Stack class peek() method 
Java :: Java Queue Array Implementation 
Java :: print values of bst java 
Java :: pretty print json in console 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =