아래의 코드에 어떤 문제가 있습니까? 실행 시간 동안 NullPointerException이 발생합니다.내 코드에 어떤 문제가 있습니까? NullPointerException
public class Test
{
public String method1()
{
return null;
}
public Integer method2()
{
return null;
}
public static void main(String args[])throws Exception
{
Test m1 = new Test();
Integer v1 = (m1.method1() == null) ? m1.method2() : Integer.parseInt(m1.method1());
}
}
Integer.parseInt (m1.method1());) - 오류 –
MyTest 란 무엇입니까? –
@AndrewThompson hah :) –