Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Creating an object of SelectedTag

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Creating an object of SelectedTag

    The code to do create an instance of class SelectedTag is as follow:
    Tag[] array;
     
      array = new Tag[4];
     
      array[1] = new Tag();
      SelectedTag d = new SelectedTag(2,array);
    The error is in line 4 which results in java.lang.NullPointerException.


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    1,069
    Thanks
    7
    Thanked 215 Times in 191 Posts

    Default Re: Creating an object of SelectedTag

    Perhaps the exception is occurring within the SelectedTag constructor.

    That's only a guess. Consider posting some code that compiles but throws that exception when it is run. Make the code as simple and short as possible to illustrate the problem.

Similar Threads

  1. [SOLVED] Need some help with creating a new object
    By bankston13 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: August 28th, 2012, 05:31 PM
  2. Creating new Object Help!!!
    By kendraheartt in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 27th, 2012, 02:59 PM
  3. Creating object everytime object is called
    By aandcmedia in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 12th, 2012, 05:18 PM
  4. Creating and implementing class for creating a calendar object
    By kumalh in forum Object Oriented Programming
    Replies: 3
    Last Post: July 29th, 2011, 09:40 AM
  5. Creating an object...
    By RodePope4546 in forum Object Oriented Programming
    Replies: 6
    Last Post: June 27th, 2011, 07:44 AM