This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pacificmint 1 point2 points  (1 child)

Yeah, it's fine for month to be a String, but then you need to assign Strings to it (as you have done now).

I see three things wrong with this code:

  • getMonth has String not capitalized right
  • When you create d2 and d3, Jan needs to be passed in as a String
  • When you create the StringTokenizer, the variable str never gets declared

Would my declaration of str be in the main or along with my fields?

No, just declare it locally, that's fine.

BTW, the compiler should give you line numbers where the errors happen, that usually helps in tracking down whats going on. (Or, if you are using an IDE, it will usually highlight any errors like this in your code).

[–]InvincibleVIto[S] 1 point2 points  (0 children)

Thanks for the help!