1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

[JAVA]Can't figure out why this is returning true.

Discussion in 'Help' started by GreenVorpal, Mar 26, 2014.

  1. GreenVorpal

    GreenVorpal Not actually green

    When I use.
    Month = 4
    Day = 26
    Year = 1997

    It returns true, and I can't seem to figure out why.

    this.getLeap() refers to whether or not it is a leap year, and can be ignored.
     
  2. Tommy

    Tommy Guest

    Code:
    public boolean IsError(){
    		boolean e;
    		e = false;
    		if (day <= 0)
    			e = true;
    		if ((month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10) && day >= 32)
    			e = true;
    		if ((month == 4 || month == 6 || month == 9 || month == 11) && day >= 31)
    			e = true;
    		if (month == 2 && this.getLeap() == true && day >= 30)
    			e = true;
    		if (month == 2 && this.getLeap() == false && day >= 29)
    			e = true;
    		if (year <= 0)
    			e = true;
    		if (month >= 13 || month <= 0)
    			e = true;
    		return e;
    
    There's java code tags.

    As for the code, your final if condition.

    Code:
                    if (month >= 13 || month <= 0)
                            e = true;
    
    At least, I believe so. I don't know java, just assuming || is equivalent to an "or".
     
  3. GreenVorpal

    GreenVorpal Not actually green

    Thanks, I actually just figured it out... I was being stupid and not setting date, month, and year in my server class, before checking to see if there was an error. Seeing as they all were defaulted to zero, naturally it was returning an error.
     

Previous Readers (Total: 0)