java - Need " " when concatenating strings? -
in code below (return statement on last line), need " " between variable firstname , middleinitial? long 1 variable string, doesn't concatenate else string when linked + ?
so example, work?
return firstname + middleinitial + lastname
if not, why not?
// name object represents name such "john q. public". public class name { string firstname; char middleinitial; string lastname; // name in normal order such "john q. public". public string getnormalorder() { return firstname + " " + middleinitial + ". " + lastname; }
the " " necessary if want space between firstname , middleinitial. if don't want space, can omit it.
Comments
Post a Comment