<font size="4">class A{</font> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>private String[] array;</font></div> <div><font size="4"><br></font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>public A(){</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>array = new String[]{"1","2","3",...,"10");</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>}</font></div> <div><font size="4"><br></font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>public String[] getArray(){</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>return array;</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>}</font></div> <div><font size="4">}</font></div> <div><font size="4"><br></font></div> <div><font size="4">class B{</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>A test;</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>String[] arraytest;</font></div> <div><font size="4"><br></font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>public B(){</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>test = new A();</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>arraytest = new String[10];</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>}</font></div> <div><font size="4"><br></font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>public void test(){</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>arraytest = test.getArray();</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>System.out.println(arraytest[1]);</font></div> <div><font size="4"><span class="Apple-tab-span" style="white-space:pre;"> </span>}</font></div> <div><font size="4">}</font></div> <div><font size="4"><br></font></div> <div><font size="4">대강 이런 형태로 코딩을 하고 있는데 이클립스는 오류가 없다고 하는데 컴파일 하면 </font></div> <div><font size="4">java.lang.NullPointerException</font></div> <div><font size="4">이러한 메세지가 뜹니다</font></div> <div><font size="4">초기화가 안되었다는데 뭐가 안된걸까요..?</font></div> <div><br></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.