Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java import random

import java.util.Random;
Comment

import random java

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 :: select word from list 
Java :: expected exception junit 
Java :: java jpa criteriabuilder in xample 
Java :: Java debug log 
Java :: java create image 
Java :: println java 
Java :: java char to charsequence 
Java :: java obtain list string from list object 
Java :: java expressions 
Java :: How to perform a breadth first search through a binary tree, in Java? 
Java :: java gettime 
Java :: get first letter of string in array java 
Java :: how to add elements to an array in java dynamically 
Java :: how to input in java 
Java :: jframe set visibility 
Java :: delete ending part of the string java 
Java :: jframe actionlistener 
Java :: install java debian 8 
Java :: inputstream to string java 
Java :: counting nodes in binary search tree 
Java :: how to find the sum of an array in java 
Java :: what is use of static block in java 
Java :: ! en java 
Java :: uppercase string java 
Java :: default method in java 
Java :: is upper in java 
Java :: java jtable change column color 
Java :: java srting array to string 
Java :: java dynamic method dispatch 
Java :: java int 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =