• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using a getter to retrieve different parameters

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am creating a program where I need to pass different parameters into a single getter and have it print out different valaues based on the paramter.

So far I have one string which I used substrings to divide the string into different chunks then convert them to ints. so now I need to assign these different ints to paramter numbers which would be passed through to the getter for printing.




this is how the different values would be passed into the getter:



Any suggestions on how I could accomplish this?

Thanks a lot for the help
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ben Hultin wrote:



i Assume IpAddress is a Constructor .

there are 2 ways to accomplish this task.
one way is provide getter/setter for octet1,octet2,octet3,octet4 . an another way is wrap the values into a single int Array and provide getter/setter .

Hope this helps
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, if you're passing a parameter into a "getter", then by definition, it isn't a "getter".

(Unless you start contemplating indexed properties -- but there are strict rules that must be followed there as well.)
 
reply
    Bookmark Topic Watch Topic
  • New Topic