私は開いて解析するファイルのリストを含むベクトルを持っており、私の場合には何が最良の選択であるか疑問に思っていました。Javaでキャッチしようとすると最適な選択
私がやり始めた何この:
for (int i =0 ; i< files.size() ; i++)
{
System.out.println("n°" + i + " : " + files.elementAt(i));
try
{
// open the files
}
catch (Exception e) {
// TODO: handle exception
}
}
か、この1についてどう思いますか?
try
{
for (int i =0 ; i< files.size() ; i++)
{
System.out.println("n°" + i + " : " + files.elementAt(i));
// open the files
}
}
catch (Exception e) {
// TODO: handle exception
}
おかげ
EDIT:
My purpose is that, when I try to open a file that doesn't exist I must throw something or maybe write the exception in a log file and continu opening the other files.
->
だから私は、最初のソリューションは、私のcituationで最高だと思いますか?
2011年に 'Vector'を使用していて、' List'や 'Set'ではないのはなぜですか? –
可能な複製[しようとすると...ループの内側か外側に入る?](http://stackoverflow.com/questions/141560/should-try-catch-go-inside-or-outside-a-loop) –
文字列を格納するだけの場合、Vectorを使用する際の問題点は何ですか? –