Results 1 to 3 of 3
- 01-26-2012, 04:06 AM #1
Member
- Join Date
- Jan 2012
- Posts
- 21
- Rep Power
- 0
i am new and this is probably an easy question help please
hi my problem is that i need my program to show (suit: 1, value: 4) but instead of that i am getting 0 and 0 i am new in java please help this is my code...
public class Card
{
private int suit;
private int value;
public Card(int suit, int value){
}
public int getSuit(){
return suit;
}
public int getValue(){
return value;
}
public static void main(String[] args)
{
Card c = new Card(1, 4);
System.out.println("suit:" + c.getSuit() + " value:" + c.getValue() + ")");
}
public String toString()
{
return "(suit:" + suit + " value:" + value + ")";
}
}
-
Re: i am new and this is probably an easy question help please
Your problem is here:
Java Code:public Card(int suit, int value){ // there's no code in here! }
- 01-26-2012, 04:17 AM #3
Member
- Join Date
- Sep 2011
- Location
- Mumbai, India
- Posts
- 35
- Rep Power
- 0
Similar Threads
-
Easy solvable question.
By xneonx in forum New To JavaReplies: 5Last Post: 10-22-2010, 01:35 PM -
Quick easy question
By jigglywiggly in forum New To JavaReplies: 8Last Post: 01-04-2010, 03:34 PM -
New to Java and have an easy question
By JBOY08 in forum New To JavaReplies: 1Last Post: 11-19-2008, 07:40 PM -
quick easy question
By jmHoekst in forum New To JavaReplies: 1Last Post: 06-19-2008, 03:28 PM -
Easy question
By JavaNoob in forum New To JavaReplies: 10Last Post: 08-03-2007, 10:28 PM
Bookmarks