SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Code Bone wrote:Hi JavaRanch/CodeRanch, looking forward to getting to know Java through this community
Code Bone wrote:There're no compilation errors, but there is a "logical error" (or whatever you call it when it can compile and run but not do what you want it to).
I want the "månad" (ie. month) in the dialogue window to display the month name and not the month number. As it is right now the month2 string remains empty for some reason.
Code Bone wrote:..but for some weird reason I get the " month2 and res might not be initialized" error in Netbeans (6.9.1)
I don't get it, how come I don't have to initialize the string dayOfWeek2 but I have to initialize the two other strings, they're the same datatype, makes no sense..
luck, db
There are no new questions, but there may be new answers.
Author of ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- OCPJP Online Training -- Twitter -- How to Ask a Question
Devaka Cooray wrote:"Code Bone", please check your private messages regarding an important administrative matter.
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Ethan Bauer wrote:
However, I still don't understand why the string dayOfWeek2 gets to be declared without the "empty string value" (ie. = "") while the strings month2 and res have to be declared and initialized with the "empty string value"?
Steve
Mos Jeff wrote:just a formatting note, if you are looking to clean your code, you may want to use an array
luck, db
There are no new questions, but there may be new answers.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
W. Joe Smith wrote:As for res, you are getting it because you are doing res += .... Basically, that is like saying res = res + ...., and since res hasn't been initialized you will get an error. If you change the statement to res = ...., then it should work.
Steve
Steve Luke wrote:Don't forget to fix your if (dayOfWeek == n) section of code though. As it is now, every day is Saturday.
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
He does not suffer fools gladly. But this tiny ad does:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
|