This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi, i want to know wether we can send any default value to a method in java. actally my problem is to send a default value to a java method some times and some time depending upon some logic i want to give soem value to it. so plese help me out in this regard. regards, Sarada Prapoorna.V
Hi there You can't set up a method in Java to accept a varying number of arguments like you can in C++. What you can do is overload the method to accept different numbers of arguments. Something like this:
this is a fairly simplistic example but you should get the idea of how it works. In your code you would just call whichever method is most appropriate based on your logic. hope that helps
------------------ Dave Sun Certified Programmer for the Java� 2 Platform