Posted by: lootekukur September 29, 2006
Java Help
Login in to Rate this Post:     0       ?        
slack, i wrote the code BASED on the definition from the link given by sajhauser. --so what I coded is right--"&&" has higher precedence than "||", so one can remove the brackets. I kept it SO THAT you understand what i was doing, it's NOT wrong syntatically to have more brackets, of course one can remove it if/when he gets the logic. --what you coded also turns out to be correct! Tell you what? You need NOT even check if a year is divisible by 100, if it is divisible by 400. coz anything divisible by 400 must also be divisible by 100. Look at this. This is perhaps the most terse and effective one. if (y % 4 ==0 && y % 100 != 0 || y % 400 == 0) return true; else return false; One request slack. when you post questions in sajha, you have to be open minded and be ready to learn what others suggest rather than having prejudice about them due to their nicks and other stuffs. THis is a virtual world my friend, you never know who is who in reality ;). Secondly programming needs a lot of practice and patience. I am sure you are hardworking, but what i saw (at least from this thread) is you are bit too impatient at times. No body is born perfect. You've got to practice to hone your skills. Please take this as a compliment from your elder brother. Good luck and have fun programming! LooTe
Read Full Discussion Thread for this article