File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in understanding the syntax

 
nilesh purohit
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bill Shirley
Ranch Hand
Posts: 457
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
nilesh purohit
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic