Jun 30, 2025
Оfftopic Community
Оfftopic Community
Forums
New posts
Search forums
What's new
Featured content
New posts
New media
New media comments
New resources
New profile posts
Latest activity
Media
New media
New comments
Search media
Resources
Latest reviews
Search resources
Members
Current visitors
New profile posts
Search profile posts
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
OffTopic Community
Introductions
Java Newbie Question?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="deonejuan" data-source="post: 2561431" data-attributes="member: 491974"><p>Java has the GregorianCalendar API which greatly simplifies this as a problem. If you are needing to re-invent the wheel... most implementations use arrays instead of logic trees. Therefore, Jan = index 0, Dec = index 11. The parallel array would then be: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31</p><p></p><p>The if(month == 1 || will evaluate as the first false and quit the gate. || does not sniff each condition going through the whole possible outcomes. && does, but || does not.</p><p></p><p>So, it takes a re-write and I don't exactly know what the purpose of the program should be.</p></blockquote><p></p>
[QUOTE="deonejuan, post: 2561431, member: 491974"] Java has the GregorianCalendar API which greatly simplifies this as a problem. If you are needing to re-invent the wheel... most implementations use arrays instead of logic trees. Therefore, Jan = index 0, Dec = index 11. The parallel array would then be: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 The if(month == 1 || will evaluate as the first false and quit the gate. || does not sniff each condition going through the whole possible outcomes. && does, but || does not. So, it takes a re-write and I don't exactly know what the purpose of the program should be. [/QUOTE]
Insert quotes…
Name
Verification
Please enable JavaScript to continue.
Loading…
Post reply
Top