0
import java.util.Random;

public class Card
{
   //instance data
   private String card,suit,x;
   private int value,y;
   private static Random generator=new Random();
   //constructor
   public Card(String cards, String suits,String xs, int values, int ys)
   {
      card=cards;
      suit=suits;
      x=xs;
      value=values;
      y=ys;
   }

//no errors here
   public String card_Face;
   {
      String[] x={"Ace", "Jack", "King", "Queen", "Diamonds", "Spades", "Clubs", "Hearts"};
   }
//no errors here
   public int vals;
   {
      int[] y={1,10,11,12,13};
   }

   //this is where the problem is
   public String random()
   {
      suit = generator.nextLine(card_Face);
      return suit;
   }
}

I'm having a compiling error at the bottom portion where it says suit = generator.nextLine(card_Face); and the program is saying cannot find symbol. Any help?

4castle
  • 32,613
  • 11
  • 69
  • 106
ali_h
  • 31
  • 1
  • 3
  • 4
    [`java.util.Random`](https://docs.oracle.com/javase/8/docs/api/java/util/Random.html) doesn't have a `nextLine` method. – Elliott Frisch Sep 18 '16 at 04:46
  • What do you mean by that – ali_h Sep 18 '16 at 04:51
  • 1
    Your code also has several initializer blocks like `{ String[] x = ... }` which are doing nothing at all since they only initialize a local variable, and not `this.x`. – 4castle Sep 18 '16 at 04:52
  • What is exactly is not allowing the generator to print a random string from the array? – ali_h Sep 18 '16 at 04:52
  • 1
    Possible duplicate of [How to randomly pick an element from an array](http://stackoverflow.com/questions/8065532/how-to-randomly-pick-an-element-from-an-array) – 4castle Sep 18 '16 at 04:53
  • Is it possible to make an accessor method to allow for those variables to be used instead? – ali_h Sep 18 '16 at 04:54
  • Alright thanks for the link – ali_h Sep 18 '16 at 04:54
  • 1
    *"What is exactly is not allowing the generator to print a random string from the array?"* Compilation errors. – Andreas Sep 18 '16 at 05:04
  • 1
    Possible duplicate of [What does a "Cannot find symbol" compilation error mean?](http://stackoverflow.com/questions/25706216/what-does-a-cannot-find-symbol-compilation-error-mean) – azurefrog Sep 18 '16 at 05:25

0 Answers0