Campbell Ritchie wrote:Unfortunately, it isn't an enumeration (small e; an Enumeration with large E is something different), nor an enum, nor anything enumerated; it is simply ints as constants in the class. Had it been enumerated, as this is, you wouldn't have the problem of entering 2 and getting MARCH. You would have a compiler error from anything requiring that enum.
Mike London wrote:. . . I didn't use the Enumeration to get Calendar.JANUARY.On behalf of the other people who gave you more of an answer than I did:-
That's a pleasure
Campbell Ritchie wrote:One reason for abandoning Calendar and Date is that the month numbers in Calendar are unintuitive.
Carey Brown wrote:If you are interfacing Java to some 3rd party package (e.g. FileMaker), then presumably there is a way to get a date back out of the 3rd party program. A date could take several forms: a String, a Date (or related) object, or some number of seconds or milliseconds since some epoch. What does FileMaker's API offer you?
Carey Brown wrote:JANUARY=0. So month '1' is FEBRUARY. Plus '1' is MARCH. Hence 2000-03-02.
Mike London wrote:Hello,
The two ways of getting a date one month in the future below do not give the same dates.
I'm confused then by what is a date one month in the future.
Calendar zcal = Calendar.getInstance();
zcal.add(Calendar.MONTH, 0); // add a month
How can these values be different? Which is correct? If both are "OK", then how do you decide which to use?
Thanks in advance,
Should have written:
Stephan van Hulst wrote:You have to ask yourself, what does it mean to add a month to a date?
Do you add a fixed amount of time? Do you just increment the month field by one? If the latter, what do you do if you end on an invalid date (such as 31st of february)?
There is no single correct interpretation. Both classes have their own interpretation of what it means to add a month. Those interpretations may or may not be what you want, but you first have to explain what it is you're trying to achieve.
sonai kale wrote:I use ubuntu 16.04 and because I already had openJDK installed, this command have solved the problem. sudo apt-get install openjfx Don't forget that JavaFX is part of OpenJDK.
Campbell Ritchie wrote:Your code compiled and ran without changes at my terminal:-The warning is about you using Data as a raw type. JavaFX has been included with the standard JDK download since (I think) Java8, four years ago. Please check whether there is an error with your IntelliJ settings. I shall add this discussion to the IntelliJ forum
Norm Radder wrote:
when I try to run it in Java 10
What do you mean by "run"?
Are the errors from compiling
or from executing the compiled code?
I get symbol not found
Can you copy the full text of the error messages and paste it here?
Hans Wursti wrote:I have exactly the same problem since last night. Seems to be on their side.
Campbell Ritchie wrote:In this thread, Liutauras drew our attention to the new version of Java®; he also proivded this link which says what the differences are. Have a look at that article and see how big the differences are. I suspect there will be relatively few Java10 books because its lifetime will only be six months.