mardi 24 novembre 2015

How to call a method(method is selecting a random string from the array) [on hold]

I have already started on a piece of code that takes a string at random from an array.I just need to call it into a method getSubstance() This is the code-

package Subway;
import java.util.Random;


public class Subway{
    private final static String[] words_1 = {"M","C","X","D","F","J","H"};

 public static void main(String[] args) {
     String random = (words_1[new Random().nextInt(words_1.length)]);
     System.out.println(random);}
 }
} 




Aucun commentaire:

Enregistrer un commentaire