• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Data types modification once they are passed to a method as an argument  RSS feed

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following data types can be modified after they are passed to a method as an
argument?
A. int[]
B. String
C. long
D. boolean

I am not sure, why A is the correct answer. In my opinion, once any argument is passed to a method, it can be modified anytime.
I am kinda confused.
Thanks
 
Ranch Hand
Posts: 277
2
Fedora Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Int arrays variables can be changed.   String is an immutable object.   The other are primitives so the references are not pointing to an address but actually has the data.  When the primitive is passed into the method a copy is made.    I think dont quote me ;)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!