Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

add methods ?  RSS feed

 
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can i add methods?
example : can it happen this?and the result of it will be 14?
 
Marshal
Posts: 4454
284
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could answer this simply enough by running the code yourself. Try it out and report back with your results.
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Cooke wrote:You could answer this simply enough by running the code yourself. Try it out and report back with your results.

worked :d
 
Tim Cooke
Marshal
Posts: 4454
284
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great! What was the value of k at the end? 14 as you predicted?
 
Bartender
Posts: 619
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And sinc you found out that it worked, what do you think this would produce?
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Fred Kleinschmidt wrote:And sinc you found out that it worked, what do you think this would produce?

the same?
 
Tim Cooke
Marshal
Posts: 4454
284
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you asking? Or telling?

Try it out yourself, and tell us what the result is. You learn by doing, so many questions can be answered with a little test program where you play with the code and see what happens.
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ekte spiriopoulos wrote:can i add methods?



Its more like you're adding/storing the results of those methods.
 
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ekte spiriopoulos wrote:can it happen this?and the result of it will be 14?


Without the method declarations (and especially the return types) of add() and addk(), it is impossible to tell if it will compile or not... And to illustrate, some of these add() methods will compile, others will not. It's up to you to determine which ones will compile and which others won't (and try to explain why), if you insert them independently
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!