×

Discussion Board

Results 1 to 2 of 2

Thread: java problem

  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    102

    Thumbs down java problem

    Please tell me whats wrong with code below
    Code:
    class touchFeeds {
            public int myTX;
            public int myTY;
            public int myTWidth;
            public int myTIndex;
    }
    private touchFeeds touchF[]=null;
    and I initialise it as
    Code:
    touchF=new touchFeeds[10];
    But when i use the code below it gives null pointer exception.

    Code:
    touchF[0].myTX=5;

  2. #2
    Regular Contributor
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: java problem

    you have declared the array , but you have not initialized objects to put there:
    Code:
    touchF=new touchFeeds[10];
    you have to create all objects using
    Code:
    touchF[0] = new touchFeeds();
    Be hungry,Be foolish
    vivart pandey

Similar Threads

  1. Problem adding Java ME MIDP Platform Emulator in NetBeans 6.5
    By furau in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2010-11-26, 09:42
  2. STLPort namespace issue
    By yickhong in forum Open C/C++
    Replies: 0
    Last Post: 2009-04-09, 08:54
  3. problem with using java application in 3600slide
    By mohu_tup in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2009-03-16, 10:53
  4. Problem with emulator (and Java) (and Python)
    By Arcilla in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2009-01-08, 17:51
  5. Installation problem for some java apps
    By seamus_rooney in forum Mobile Java General
    Replies: 1
    Last Post: 2006-11-08, 17:14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×