Hi struggling with java - we have a class Structures and Algorithims
in which we are supposed to pick up java in 5 weeks
Have been pouring over material and searching sites but trouble is when I start to write ends up nothing seems to work unless we copy and paste from the text - very frustrating noone to ask what happens if i do it this way or why does etc etc not work
For example we had to do the card hand thing for assessment
which is now done and dusted
I tried to do a string array and found the multidimensional string
now assessment is over still want to know how to do it and cannot understand why the below does not work / compile
import java.util.*;
public class Card
{
private String[][] card={{"Hearts","Clubs","Diamonds","Spades"},
{"Ace","Deuce","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"}};
final int SUITE_NUM = 4;
final int CARD_VAL_NUM = 13 ;
public Card()
{
Card card=new Card();
int x = (int)(Math.random()*(SUITE_NUM))+1;
int y =(int)(Math.random()*(CARD_VAL_NUM))+1;
this.card = card[0][x]+ card[1][y] ;
}
public String toString(){ return this.card +"," ; }
}
o c++ is soo much easier to understand .. sigh
any input most sincerely welcome and hope you do not mind if i come back with more since i do not seem to be getting any answers in class - thanks in advance