473,405 Members | 2,171 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,405 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 1784
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.