2
나는 안드로이드와 자바에 익숙하지만 프로그래밍에는 익숙하지 않다. (이클립스 사용하기). 메서드에서 다음과 같은 예제 코드를 실행하려고합니다.InputStream 선언
private void dummy() {
try {
URL url = new URL(quakeFeed);
URLConnection connection;
connection = url.openConnection();
HttpURLConnection httpconnection = (HttpURLConnection)connection;
int responseCode = httpconnection.getResponseCode();
if(responseCode == HttpURLConnection.HTTP_OK)
InputStream inp = new BufferedInputStream(httpconnection.getInputStream());
}
...
}
다른 모든 구문과 변수가 정의되어 있다고 가정합니다. 나는 다음과 같은 오류 얻을 : 나는 방법 밖에 InputStream
를 선언하면 내가 궁금
InputStream inp;
private void dummy() {
try {
URL url = new URL(quakeFeed);
URLConnection connection;
connection = url.openConnection();
HttpURLConnection httpconnection = (HttpURLConnection)connection;
int responseCode = httpconnection.getResponseCode();
if(responseCode == HttpURLConnection.HTTP_OK)
// Changed
inp = new BufferedInputStream(httpconnection.getInputStream());
}
...
}
즉,
InputStream` cannot be resolved to a variable.
이 이상한 경우에도 java.io.InputStream;
오류가 꺼집니다 가져 오기 후를 왜 로컬 선언 InputStream
을 (를) 확인할 수 없지만 전역 선언이 해결되었습니다.
좋아 덕분에 나는이 알고 않네. –