473,287 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

nullpointerexception initializing map

oll3i
679 512MB
Expand|Select|Wrap|Line Numbers
  1. Map<String,String>[] rowsMap = null;
  2. ....
  3.  
  4. for(int i=0; i<numberOfRows; i++)
  5.       rowsMap[i]= new HashMap<String, String>(); 
  6.  
throws nullpointerexception ?


thank You
Nov 15 '08 #1
5 1779
Nepomuk
3,112 Expert 2GB
First of all: Please use the [CODE]...[/code] tags! You've been a member of bytes.com for long enough to know that.

About your question: Yes, it does throw a NullPointerException. You're missing a
Expand|Select|Wrap|Line Numbers
  1. rowsMap = new Map<String,String>[numberOfRows];
before that loop.

Greetings,
Nepomuk
Nov 15 '08 #2
JosAH
11,448 Expert 8TB
First of all: Please use the [CODE]...[/code] tags! You've been a member of bytes.com for long enough to know that.

About your question: Yes, it does throw a NullPointerException. You're missing a
Expand|Select|Wrap|Line Numbers
  1. rowsMap = new Map<String,String>[numberOfRows];
before that loop.

Greetings,
Nepomuk
You can't have generics in an array type; make that:

Expand|Select|Wrap|Line Numbers
  1. rowsMap = new Map[numberOfRows];
kind regards,

Jos
Nov 15 '08 #3
oll3i
679 512MB
how do i suppress unchecked conversion warning in jsp in java class
@SuppressWarnings ("unchecked") works but in jsp eclipse shows a warning
Nov 15 '08 #4
JosAH
11,448 Expert 8TB
how do i suppress unchecked conversion warning in jsp in java class
@SuppressWarnings ("unchecked") works but in jsp eclipse shows a warning
I don't know where to put that @annotation to keep Eclipse's mouth shut in a
jsp file. Arrays and generics always have been a bit of a problem; read this.

kind regards,

Jos

ps. warnings here are harmless though; don't pay too much attention to them.
Nov 15 '08 #5
oll3i
679 512MB
thank You guys a lot i made it (hm we made it) finished everything works :) :) :)
i can have a break :)
so till the next project
Nov 15 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: K S Aldebaraan | last post by:
I'm trying to submit a form with an action of a servlet, and a view equal to the same jsp page. I'm not sure what I'm doing wrong, but keep getting a NullPointerException on the second line of...
4
by: gabryh | last post by:
Hi, The following code throws me NullPointerException. ..... public static boolean isEmpty(String value) { return ((value == null) || (value.trim().equals(""))); }
0
by: Old-timer | last post by:
Not sure where else to post this. I'm sure I'm doing something wrong, but I wouldn't think a simple app would give me so much trouble. I've got a small test java class that I'm trying to have...
13
oll3i
by: oll3i | last post by:
private List<Klient> klienci; m_add_client.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ...
1
by: ketand1 | last post by:
import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.sql.*; import java.lang.*; class DbAwt extends Frame implements ActionListener { private...
2
by: sokeefe | last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that...
1
by: sokeefe | last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that...
1
by: r035198x | last post by:
This exception occurs often enough in practice to warrant its own article. It is a very silly exception to get because it's one of the easiest exceptions to avoid in programming. Yet we've all got it...
3
by: chris123456789 | last post by:
Hi, when I run my code I get a NullPointerException:null. Here is the part of the code where the error occurs: import java.util.*; import java.io.*; public class Decrypt { ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.