public void copy(String source, String target)
{
//복사 대상이 되는 파일 생성
File sourceFile = new File( source );
//스트림 선언
FileInputStream inputStream = null;
FileOutputStream outputStream = null;
try
{
//스트림 생성
inputStream = new FileInputStream(sourceFile);
outputStream = new FileOutputStream(target);
int bytesRead = 0;
//인풋스트림을 아웃픗스트림에 쓰기
byte[] buffer = new byte[1024];
while ((bytesRead = inputStream.read(buffer, 0, 1024)) != -1)
{
outputStream.write(buffer, 0, bytesRead);
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
//자원 해제
try
{
outputStream.close();
}
catch(IOException ioe){}
try
{
inputStream.close();
}
catch(IOException ioe){}
}
}
void is an invalid type for the variable copy이 에러가 떠서 돌아가지가 않는데 왜 그런지 모르겠네요 ㅠㅠ




해당 에러 밑에 syntax error 는 없던가요? method 명을 copy 말고 다른 이름을 써보세요.