• 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

String[ ] to File[ ]

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a doubt. Can String array be casted to a File Object array?
It seems to be okay, but just wanna confirm this as the code where i have implemented this can not be build and executed now to check this.
The string array contains the abolute paths to files.
Any comments on this will be appreciated,
Thanks.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anupam Bhatt:
Hi,
I have a doubt. Can String array be casted to a File Object array?
It seems to be okay, but just wanna confirm this as the code where i have implemented this can not be build and executed now to check this.
The string array contains the abolute paths to files.
Any comments on this will be appreciated,
Thanks.



A String object can *not* be casted to a File object.

A String array object can *not* be casted to a File array object.

Henry
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Henry, Thanks for this.
So now my problem is i have a array of strings[which contains absolute paths to file], but i want to return a array of file objects.

What can be the best possible approach to this ?

Thanks
 
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Anupam,
I have no idea if this is the best way to do it. But, here's what I suggest:
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shyam,
Thats what exactly what i thought the solution and did. And your reply confirms the same .
Thanks,


Originally posted by Shyam Murarka:
Dear Anupam,
I have no idea if this is the best way to do it. But, here's what I suggest:

 
reply
    Bookmark Topic Watch Topic
  • New Topic