• 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

is String[] Serializable?

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what's the difference between using Arrays type and using String[]?

Thanks
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand your question: Arrays is a class in java.util. String[] is (half of) the way you declare an array of Strings. Can you restate your question please?
 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i don't know of any difference between a String array and any other kind of array, so if arrays in general are serializable, so should a String[] be.

but there's an easy way to find out: exploratory coding! i just wrote a little program a little like this one:

and it told me that String[]'s are indeed serializable.

i'm not really sure what you mean by "using the Arrays type", however. could you clarify that?
 
Elinor Chang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for the confusion. I didn't mean by Array type but an array of something in general. I'd like to find out if an array of object or primitive type, not just String[], is serializable. e.g. int[], String[], etc..
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All array classes are serializable. It says so in the JLS.
 
Elinor Chang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right. JLS does specifies all array types implement the Serializable interfaces. Thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic