This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes problem in understanding the syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem in understanding the syntax" Watch "problem in understanding the syntax" New topic
Author

problem in understanding the syntax

nilesh purohit
Greenhorn

Joined: Oct 31, 2007
Posts: 4
Can you please clarify the meaning of the following line of code
boolean setFlag(Boolean [] test []);
assume test is some class.Nothing was mentioned in the book.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by nilesh purohit:
Can you please clarify the meaning of the following line of code
boolean setFlag(Boolean [] test []);
assume test is some class.Nothing was mentioned in the book.

As it's written, the only way I can see this working is inside an interface, as an implicitly abstract method declaration where "test" denotes a 2-dimensional Boolean array.

But if we are to assume that "test" is some class, then we need a comma between these arguments. In that case, the line is close to working as a method call with an added assignment ("b ="), or simply a method call (without "boolean"). That is...

boolean b = setFlag(Boolean[], test[]);

...or just...

setFlag(Boolean[], test[]);

Where did this come from? And what is the context?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
ouch, someone hates you,

it looks like a declaration of a method from an interface,
(obviously) it returns a boolean,

it takes a 2 dimensional array of Boolean objects, the parameter name is test,

it would more nicely be coded:

for better or for worse, they are all equivalent

useful examples:
http://www.janeg.ca/scjp/lang/arrays.html
[ December 18, 2007: Message edited by: Bill Shirley ]

Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
nilesh purohit
Greenhorn

Joined: Oct 31, 2007
Posts: 4
thank to all for clearing the doughts.It was an Interface declarations.But I was not knowing about array declaration can be done in this mannaer also.
Thanks once again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in understanding the syntax