|
-
writing a method with object parameters
im writing a class that performa arithmetic on weights, im trying to write a method that adds two weight objects together (in my case the weights are in pounds and ounces so the method itself will add the pounds and ounces individually but i want to parse 2 weight objects to the method
what wil the mthod delcartion be to write such a method?
public ? addWeights(Weights w1, Weights w2){
//implementation
}
//called from a test program
Weights w1 = new Weights(13, 12)
Weights w2 new Weights(10, 3)
addWeights(w1, w2)
pelase help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks