954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

boolean array

Is there a way to get this down to one line of code?

boolean [] myArrary = {true, false};
return myArrary;


I'm trying to combine those lines into one, but I am not sure what the correct syntax would be.

Thanks, sj

Sailor_Jerry
Junior Poster in Training
88 posts since Aug 2005
Reputation Points: 13
Solved Threads: 2
 

Care to elaborate.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

the syntax you're looking for is:

return new boolean[] {true, false};
jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

ahh thanks. I didn't have the "new" keyword

Sailor_Jerry
Junior Poster in Training
88 posts since Aug 2005
Reputation Points: 13
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You