배열을 반환하는 메서드를 만들면 궁금합니다. 어떻게하면 주 또는 다른 방법으로 해당 배열의 특정 지점에 액세스 할 수 있습니까? 액세스하려고하는 경우배열의 특정 지점에 다른 방법으로 액세스하는 방법
int [] myArray = yourClass.deleteElement(thing, target)
yourClass.test(myArray);
:
예를 들어: 당신이 다른 방법으로 배열을 전달하려는 경우
public static int[] deleteElement(int[]thing, int target){
int[]newThing;
newThing=thing;
int y=0;
for (int i=0; i<thing.length; i++){
if (thing[i]==target){
newThing[y]=thing[i+1];}
y++;
}
return newThing;
}
public static int test(int[]someArray){
//here how can i access newThing[i]?
}
감사 무리
??? 너는 그것에 접근했다. 문제가 무엇입니까? –
질문이 분명하지 않습니다. 다른 메소드가 같은 클래스의 멤버입니까? deleteElement()의 호출자입니까? 어레이에 언제 접속하고 싶습니까? 그리고 알려진 색인에 액세스하는 색인입니까? – Elist