Thread: Java program issue

Results 1 to 3 of 3
  1. #1 Java program issue 
    Registered Member
    Join Date
    Nov 2010
    Posts
    21
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Trying to do my java homework but this this issue
    public boolean hasOnePair(PokerHand tester){
    for(int i=0;i<tester.getCardCount();i++){
    for(int v=1;v<tester.getCardCount();v++) {
    if(tester.getCard(i).getValue()!=tester.getCard(v) .getValue())
    return false;

    }

    }
    return true;
    }
    }
    It always returns false, regardless.
    this is a hand of cards(5)
    Whats the issue?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Nov 2010
    Posts
    21
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    nvm, got it.
    Reply With Quote  
     

  3. #3  
    Donator


    Join Date
    Mar 2013
    Age
    24
    Posts
    1,767
    Thanks given
    335
    Thanks received
    386
    Rep Power
    318
    You have been Java Homework for a Reason, to make you think and fix Errors yourself.
    Only ask for help when you are absolute 0.

    Also, the problem was the if statement was true and returned the boolean as false.
    if(tester.getCard(i).getValue()!=tester.getCard(v) .getValue())
    return false;
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. My first complex java program :D
    By Exsinity in forum Application Development
    Replies: 19
    Last Post: 07-20-2009, 12:51 AM
  2. Java programming.
    By Elysian2 in forum Application Development
    Replies: 3
    Last Post: 03-22-2009, 09:03 AM
  3. [PROPER] Best Java Programer
    By Alex in forum Voting
    Replies: 60
    Last Post: 06-21-2008, 06:52 PM
  4. Helpful server hadnlers & .java programs
    By pureowner in forum Tutorials
    Replies: 7
    Last Post: 01-10-2008, 01:10 PM
  5. Fundamentals of 3D Java Programming
    By Fallen Azn SinZ in forum Tutorials
    Replies: 21
    Last Post: 01-05-2008, 07:47 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •