@WannaCreative

Почему выскакивает NullPointerException [ООП]?

Есть код в 1-ом файле (Main.java)
public void setGlory(long glory)
    {
        this.glory = glory;
    }


и код во втором файле

Main m;
public Bank() throws InterruptedException, IOException
    {
        this.glory = Main.getGlory();
        System.out.println("Your balance is: $"+money);

        private void depositMoney() throws InterruptedException
    {
        for (int i = 0; i < 10; i++)
        {
            this.glory++;
            System.out.println("Your glory is: ★"+glory);
            Thread.sleep(1000);
        }

        m.setGlory(glory);
    }
    }


После цикла for - выскакивает ошибка, не пойму, почему
  • Вопрос задан
  • 128 просмотров
Решения вопроса 1
al_gon
@al_gon
m.setGlory(glory);

m не null?
дебажте здесь!
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы