java - Making my method return a string -


i trying make program deal hand of cards randomly generate. reason can't print string method in main program. i'm not sure if i'm missing or if it's wrong, i'm rather new java scene. got.

public class deck {   public static void main (string args[]) {     builder();     out.println("your hand is:" card )   }   // build deck   public static string builder() {     // need pick random array     random r = new random();      // array, make 1 need [] before string     //this how ending     string[] suitsa = { "hearts ",  "diamonds ", "spades ", "clubs" };     // number array     string[] facea = {"1","2","3","4","5","6","7","8","9","10","king ", "queen ", "jack ", "ace ",};      // picks random set arrays      string suit = suitsa[r.nextint(4)];      string face = facea[r.nextint(14)];      //tryng make 1 string return     string card = ( suit + " of " + face );      // might give me value use in method below     out.println( card );     return;   } } 

you not returning calculate card value (string) method. return string this

 string card = ( suit + " of " + face );      // might give me value use in method below  return card; 

and use in main method

public static void main (string args[]) { string value=builder(); out.println("your hand is:"+ value ) } 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -