+ 1
Question about variable format
So, I was going through the strings portion of java and ran across a variable like this: "String var;" and underneath it said "var = "string here";". My question is why not simply say "String var = "string";"?
3 Respostas
+ 3
smart boy. why dont you give it a go in codeplayground. ps check out c++ if you get the chance
+ 2
So I checked in the code playground and they both work, I'm assuming you'd separate the declaration and value when you want to keep things organized a bit more than usual?
+ 2
yep. keeping them seperate makes it a little easier to read later on.