Questions tagged as 'nullpointerexception'

2
answers

I have an error that I can not identify in println

These are my classes but the error occurs:    Exception in thread "main" java.lang.NullPointerException       at official.20.main.main (Principal.java:16)   /home/lucas/.cache/netbeans/8.1/executor-snippets/run.xml:53: Java returned: 1   BUIL...
asked by 17.11.2016 / 23:15
2
answers

I believe my error is in arrays, or type conversions, but how to solve?

I'm new to java and I have to do a tetris. In this class in particular, I create 2 control arrays to manage the positions of the pieces on the screen, but it is giving error. Does anyone have some time to help the newbie? package jogo; import...
asked by 08.10.2015 / 02:46
1
answer

NullPointerException when trying to open database

I'm trying to include an item in the DB that was selected, but when I try to open the database using .open(); I'm getting a NullPointerException error. After the user selects which item to save, I display AlertDialog and r...
asked by 17.06.2015 / 16:06
1
answer

NullPointerException in java. Save image to bin folder so the software runs without errors?

I'm developing a project in java and putting images in jLabels , however, every time I run the program, it displays a message " Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException " and does not execute, loads up...
asked by 01.09.2016 / 17:17
2
answers

About method chaining. Why is giving nullPointerException?

I have the class Request: package teste; import java.util.ArrayList; import java.util.List; public class Pedido { List<Item> lista = new ArrayList<Item>();; Cliente cliente; public Pedido adicionarPedido(int qu...
asked by 14.11.2016 / 19:45
3
answers

System.NullReferenceException in an attribute of type StringBuilder

What causes the error to occur? How to correct? Model: public class modelExemplo { public StringBuilder listNewsletter { get; set; } } Controller: public ActionResult funcaodeteste() { modelExemplo obj = new modelExemplo()...
asked by 25.10.2017 / 14:00
1
answer

NullPointerException error while executing while [closed]

public List<Produto> read(){ Connection con = ConexaoMysql.conectar(); PreparedStatement stmt = null; ResultSet rs = null; List<Produto> produtos = new ArrayList<>(); try { stmt = con.prepareStatem...
asked by 15.12.2016 / 00:15
1
answer

Problem with AVL tree vector

Good afternoon! I'm doing a hash table and for this I'm trying to create an AVL Tree vector. The problem is that when I try to insert a value into any tree of this vector it is giving the "NullPointerException" exception. Could someone tell m...
asked by 02.10.2017 / 20:46
1
answer

How to handle Null records? In the bank or app? (java & mysql)

I'm integrating a legacy (MySQL) database with a new module (Java - this problem-giving object is a bean) that I'm developing. I have a method that does a select and returns some results that possibly have some null data and thi...
asked by 25.04.2018 / 22:28
1
answer

java.lang.NullPointerException: Attempt to invoke virtual method [duplicate]

My program gave this problem when I tried to create a stack (database), to store strings in my Android app package com.project.meuapp2; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bu...
asked by 27.03.2016 / 20:39