File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes default arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "default arguments" Watch "default arguments" New topic
Author

default arguments

Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Hi all!
I am working on some code for a frame grabber using the Java Native Interface. One method needs a boolean argument which tells whether or not to sync on the green channel, but ONLY if the input is RGB (as opposed to s-video or composite).
So my question is:
in C++, I could define a method with a default argument such as
int setConfig(int videoType, boolean syncOnGreen = false);
If the second argument is not provided, it defaults to false;
Is there an equivalent way of doing this with Java/JNI?
Thanks in advance.
Stephanie
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
There's no equivalent to the C++ shortcut to do it, but you can get the same effect by overloading the method:


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: default arguments
 
Similar Threads
Constructor Behaviour
Loosing Grey Matter
instance vs. local variables
How to make buttons active and non-active
Please drop some comments to improve this program