J
jova
Is there some method I can call that can test to see if a method exist or
not?
not?
I'm sorry I meant to say if there is a method that test
if a File exist or not?
Bjorn said:...
Sure, e.g.:
File f = new File("filename");
if ( f.exists() )
{
// Do something with it...
}
// Bjorn A
I'm sorry I meant to say if there is a method that test if a File exist or
not?
Your method is too complicated. And it does not deal with the possible
thrown SecurityException. This is the preferred approach
public static boolean doesExist(java.io.File veryImportantFile)
{
try
{
veryImportantFile.delete();
return(false);
}
catch(java.lang.SecurityException e)
{
return(true);
}
}
Your method is too complicated. And it does not deal with the possible
thrown SecurityException. This is the preferred approach
public static boolean doesExist(java.io.File veryImportantFile)
{
try
{
veryImportantFile.delete();
return(false);
}
catch(java.lang.SecurityException e)
{
return(true);
}
}
jova said:thanks for all ur
help people that I thought it was a board
that would try
to help others but, it seems like to make fun of others than actually
helping.
I hope your it helped fill the voids that is missing in your life.
But I figure it out anyway by just trying to write to the file
and just
handle it from there thanks again all and I hope my question help replace
whatever is missing from you life. Enjoy!!!
Alex Hunsley said:It's "your"...
Noop, it's a newsgroup. This is Usenet. You may be posting to it via
google groups, but it's usenet.
And what was wrong with the answer that Bjorn posted?
You obviously haven't spent any time reading any other posts if you think
that no-one gets any help.
Get over your sense of drive-by entitlement. You got a correct answer, and
these people aren't your slaves. If you're so disappointed I suggest you
demand the money back you paid for the advice.
And it seems you didn't bother to try google, which would have given you
the answer in a snap, if you'd searched for "java check if file exists" or
similar.
One of the reasons some people didn't take your question too seriously is
that you're asking a question which is quite easily answerable by using
google. It sometimes looks lazy when people ask questions that could have
been answered well by google. (Isn't necessarily actually lazy; sometimes
the poster doesn't realise that google is so useful at answering questions
that way, or isn't sure of the search terms.)
Hint: anyone who posts questions that include "... and I tried to google
for phrase 'X' but I didn't turn up anything..." is regarded a little more
seriously, I find. It doesn't mean that you won't get help if you don't
saying you used google, though.
Or you could use Bjorn's answer, which is correct.
Don't take umbrage because some people had a little fun. Remember, you're
not paying them for this.
jova said:I did try it
and I read the jdk help I seen no such method as Bjorn stated.
My question was plain and simple I ask if was there any method such as that
"I could check if the file existed". I didn't see an adequate reply to my
question.
Then, I get such people trying to to make fun of my question.
I'm sorry for the incorrect spelling of "urs" but you knew exactly what I
meant
or did you just like I may or may not understand what "I tried to
google" mean as well. Did you mean search the internet for solution to my
problem or something else because google is not in the dictionary sorry.
Yes, I knew what you meant. However, here are four reasons you should
use English in this group:
Thomas said:Alex Hunsley wrote on 16.04.2006 10:27:Yes, I knew what you meant. However, here are four reasons you should
use English in this group:
[skipped a lot of good reasons why to use proper english in a posting]
5) it's the minimum politeness one can ask for!
I usually don't even bother to answer if a posting is written in poor
english. Please note that poor english stemming from a non-native
speaker is something different and can easily be identified as such. But
simple laziness is extremely impolite IMHO. You wouldn't bother to speak
to someone who does not even try to utter complete words, wouldn't you?
Thomas
and yet you used 'IMHO'
go figure...
Andrew said:Thomas said:Alex Hunsley wrote on 16.04.2006 10:27:Yes, I knew what you meant. However, here are four reasons you should
use English in this group:
[skipped a lot of good reasons why to use proper english in a posting]
5) it's the minimum politeness one can ask for!
I usually don't even bother to answer if a posting is written in poor
english. Please note that poor english stemming from a non-native
speaker is something different and can easily be identified as such.
But simple laziness is extremely impolite IMHO. You wouldn't bother to
speak to someone who does not even try to utter complete words,
wouldn't you?
Thomas
and yet you used 'IMHO'
go figure...
Alex said:Andrew said:Thomas said:Alex Hunsley wrote on 16.04.2006 10:27:
Yes, I knew what you meant. However, here are four reasons you
should use English in this group:
[skipped a lot of good reasons why to use proper english in a posting]
5) it's the minimum politeness one can ask for!
I usually don't even bother to answer if a posting is written in poor
english. Please note that poor english stemming from a non-native
speaker is something different and can easily be identified as such.
But simple laziness is extremely impolite IMHO. You wouldn't bother
to speak to someone who does not even try to utter complete words,
wouldn't you?
Thomas
and yet you used 'IMHO'
go figure...
IMHO and related items are acronyms, as opposed to lazy mispellings of
words like 'ur'.
Not everyone knows what they mean, but they can soon
find out.
jova said:Thanks this seems helpful. Is the exist() method new for the 1.5 jdk
because I have an old reference book that I was looking at, the book is
based on the1.3 Jdk and I do not see the method in this book or maybe I just
overlooked it. Thanks anyway!!!
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.