NullPointerException question (probably easy)

Hi,
I am currently using a JDK 1.2 release from 1999 or so.
In a class, I have an array:
class foo {
double bar[];
In a method, I populate the array:
void foobar ()
bar = new double[13];
bar[0] = 0.0;
... // all 13 elements assigned values
Nothing else touches the array.
I instantiate the class as "g" and call g.foobar()
As soon as it returns, g.bar is null. Referencing it gives NullPointerException.
help?
the bug database comes back with too many hits to look through for NullPointerException. I've encountered this bug before, usually able to work around it, not this time. The class implements a bunch of gradients for a nonlinear programming (NLP) problem. I can send anyone who is interested the source.
I probably just need a patch. Can someone point me toward one?

import java.io.*;
import java.util.*;
class find2 {
     double bar[];
     void foobar(){
          bar = new double[13];
          for(int i=0;i<13;i++){
               bar[i] = i*1.1;
     public static void main (String args[]){
          find2 g = new find2();
          g.foobar();//comment this line and see
          for(int j=0;j<g.bar.length;j++){
               System.out.println(g.bar[j]);
          for(int j=0;j<g.bar.length;j++){
               System.out.println(g.bar[j]);
}i just tried this little program, i just initialized as you have done in the foobar() method, U can see, if in the main program, if you comment out the line g.foobar(); then it throws a nullpointerException, otherwise it will not, so, i guess you are not calling the method before trying to access the bar values

Similar Messages

  • Strange but probably easy problem

    Strange but probably easy problem...
    I have made two pages recently. One for a company and one for
    a game I'm making during my spare time. I have made them both in
    the same way with an html page for every side.
    The problem is that when it changes sides... On the first
    page I made it looks like it leaves the back ground graphic and
    just reload the text that has changed... this is how I want it to
    be. But on the second it loads the backgrounds's every time...
    These are the links... I hope someone understands what I mean
    1st page www.ardent.se
    2:nd page www.indylc2.com

    cjh81 wrote:
    > Strange but probably easy problem...
    >
    > I have made two pages recently. One for a company and
    one for a game I'm
    > making during my spare time. I have made them both in
    the same way with an html
    > page for every side.
    >
    > The problem is that when it changes sides... On the
    first page I made it looks
    > like it leaves the back ground graphic and just reload
    the text that has
    > changed... this is how I want it to be. But on the
    second it loads the
    > backgrounds's every time... These are the links... I
    hope someone understands
    > what I mean
    >
    >
    > 1st page www.ardent.se
    > 2:nd page www.indylc2.com
    >
    it's the same, but the first page loads faster than the
    second.
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    Downloads: Slide Show, Directory Browser, Mailing List

  • Getting my first external hd -- my questions are probably easy

    Hi.
    The questions I have are probably pretty easy, and have probably been answered here before, but, I wouldn't even know what to put into a search to bring these answers up. . .
    I'm getting my first external hd. I'm wondering if once I have some media backed-up to it, if I'll be able to use applications on my home computer disk to open the files (be able to play mp3s on the external drive in iTunes, namely). A sub-question is - would it be possible to just install my os on the external and boot from it (this isn't important, though)? Also, if any of this is possible, is it terrible to run the external all day as I do my iBook?
    I guess this hd isn't even really for back-up, but for more space, really. I just don't want to try to install a new internal hd myself, I don't want to have to send my computer in, and this drive will eventually be for back-up, anyway.
    One last thing. Should I just browse around the Apple online store for this hd, or could anybody point me toward someplace cheaper (looking to get one that's at least 250 GB)?
    Thank you for any help in advance,
    Daniel
    Message was edited by: Daniel Lynn

    You will be able to use your external hard drive to open files from. Example of iTunes:
    * If you organise your music folder so that all music is moved to a central location you will have to move your iTunes music folder to your external drive. See:
    http://docs.info.apple.com/article.html?artnum=301748
    * If it is set so your music stays at its current location when importing then all you have to do is import files from your External HDD.
    If it is a firewire (not USB) hard disk you can install/Boot Mac OS X from it. It is fine to run OS X permanently from your external HDD although it may be a little slower than running off your internal hdd drive.
    Note on new intel macs you can boot off USB drives, PPC macs like your iBook need firewire.
    Good Luck!

  • Two questions about FLV- probably easy!

    Hi!
    I'm having some fun using the flash video features in F8Pro
    and have a few questions:
    Using the MediaPlayback component:
    1. How do I get the movie to play at full size in the
    available window? The FLV is 320x240, the component is also sized
    at 320X240- but the video plays at a smaller size in the area above
    the controls. How can I get it to take up 100% of the available
    play area?
    2. Is there a way to load/unload a graphic instead of having
    a blank, black screen sitting there at the beginning?
    Using FLV (I'd rather use this format because of video size):
    1. I have the FLV on the stage and want to load a graphic
    when the movie is buffering, and then unload it when the user
    presses play. How do I do that? I tried using some of the
    FLVPlayBack behaviors, but could not get the unload to work
    properly.
    Thank you in advance for your time!

    Hi,
    I have two tables in a view. The second table changes the content according to the leadselection-row in first table. This is easy to realize with normal table , but how can I realize this with ALV?
    For this jut make a method of event handler type and select event as ON_LEAD_SELECT. Now in this method get the lead selected values by simply reading the node with help of code wizard. You'll get the lead selected values in a work area. Now use this work area to get the required values in the node which you want to display in the other ALV. To display the lead selected data in another ALV, you need to add alv component twice. Now bind the node which has the data extracted with the help of lead selected data with that DATA node of second ALV component.
    I hope it helps.
    Regards
    Arjun
    Edited by: Arjun on Jan 22, 2009 9:13 AM

  • Two question about FLV- probably easy!

    Hi!
    I'm having some fun using the flash video features in F8Pro
    and have a few questions:
    Using the MediaPlayback component:
    1. How do I get the movie to play at full size in the
    available window? The FLV is 320x240, the component is also sized
    at 320X240- but the video plays at a smaller size in the area above
    the controls. How can I get it to take up 100% of the available
    play area?
    2. Is there a way to load/unload a graphic instead of having
    a blank, black screen sitting there at the beginning?
    Using FLV (I'd rather use this format because of video size):
    1. I have the FLV on the stage and want to load a graphic
    when the movie is buffering, and then unload it when the user
    presses play. How do I do that? I tried using some of the
    FLVPlayBack behaviors, but could not get the unload to work
    properly.
    Thank you in advance for your time!

    try this:
    StringTokenizer tkn = new StringTokenizer(str, ", ");
    while (tkn.hasMoreTokens()) {
    Strint num = tkn.nextToken();
    if ("1".equals(num))
    !!!!!!!! GOT IT !!!!!!!!!!!!!
    }

  • Probably Easy XSD Question

    I wrote the 2 files below (1 xml and 1 xsd). I think the XSD is correct but I'm pretty sure I'm not linking the XML to the XSD correctly. I think this because I can delete a line from the XML file that the XSD says is required and still view the XML file in an IE6 browser without getting an error message. So, 2 questions. 1) is my check (bringing the xml file up in an IE6 browser) an acceptable check? 2) How do I link these 2 files together so the XSD actually does check the XML file. I took a guess at it from some examples I found online but I know I'm almost certain I'm not doing it correctly.
    myXML.xml
    <?xml version="1.0"?>
    <teamList xmlns="http://www.w3schools.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.kevin.com myXSD.xsd">
         <sport id="nhl">
              <team>
                   <name>NY Rangers</name>
                   <record>
                        <wins>35</wins>
                        <losses>47</losses>
                   </record>
              </team>
              <team>
                   <name>NJ Devils</name>
                   <record>
                        <wins>50</wins>
                        <losses>32</losses>
                   </record>
              </team>
         </sport>
         <sport id="mlb">
              <team>
                   <name>NY Mets</name>
                   <record>
                        <wins>81</wins>
                        <losses>81</losses>
                   </record>
              </team>
              <team>
                   <name>NY Yankess</name>
                   <record>
                        <wins>100</wins>
                        <losses>62</losses>
                   </record>
              </team>
         </sport>
    </teamList>------------------------------------------
    myXSD.xsd
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         targetNamespace="http://www.kevin.com"
         xmlns="http://www.w3schools.com"
         elementFormDefault="qualified">
         <xs:element name="teamList" type="teamListType" />
    </xs:schema>
    <xs:complexType name="teamListType">
         <xs:sequence>
              <xs:element name="sport" type="sportType" />
         </xs:sequence>
    </xs:complexType>
    <xs:complexType name="sportType">
         <xs:sequence>
              <xs:element name="team" type="teamType"/>
         </xs:sequence>
    </xs:complexType>
    <xs:complexType name="teamType">
         <xs:sequence>
              <xs:element name="name" />
              <xs:element name="record" type="recordType"/>
         </xs:sequence>
    </xs:complexType>
    <xs:complexType name="recordType">
         <xs:sequence>
              <xs:element name="wins" type="xs:numeric"/>
              <xs:element name="losses" type="xs:numeric"/>
         </xs:sequence>
    </xs:complexType>

    Set the default namespace the same as the targetNamespace.
    <teamList xmlns="http://www.kevin.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.kevin.com myXSD.xsd">
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         targetNamespace="http://www.kevin.com"
         elementFormDefault="qualified">
    thanks,
    Deepak

  • Really dumb and probably easy question

    Hey everyone. This is prob a very naive and seemingly stupid question, but how do I compile a package so that I get the .class files that I need to incorporate a library into my project? I downloaded this package I need, but it only has .java files in it. Im using Windows 95 and Borland Jbuilder.
    Thanks very much for the help!
    Rick

    You need to download the newest Java 2 Platform, Standard Edition (J2SETM) software. A release of the Java 2 Platform, Standard Edition version 1.4 software for Windows, Linux, and Solaris is now available to the Java community!
    Follow this link to download it: http://java.sun.com/j2se/1.4/download.html
    Once you get it, it can be a little tricky to install it. You may need to set you system's path setting differently depending on your OS.
    Once you get this installed you can access the file you need by going into the directory, under your command prompt (go to run, then they cmd), the .java file is and type javac (for java complier) program name.java. This will turn it into a class file.
    Example:
    javac Lala.java -> Lala.class
    Hope that helps

  • Small, Probably Easy Question About LaunchDaemons/LaunchAgents

    Can the "weekday" value in "StartCalendarInterval" take multiple values?
    In other words, if I want a LaunchAgent or LaunchDaemon to run every weekday, can I create just one that has the value "1,2,3,4,5" for "weekday"? Or do I need to create five separate ones, one for each weekday of the week?

    I'm no expert but try setting the start intervals to an array of dictionaries rather than a single dictionary.

  • HTML(extremeley easy question probably)

    Does anyone know why this code wouldn't work, it is HTML. Everytime I run it an x appears where the applet should and in the corner it says applet notinited, I don't believe it has anythhing to do with the java code.
    <applet code="cow.class" width="100", height="100">
    </applet>

    Hi Mediocre_Man,
    For a start, remove that comma between width and height (not standard markup), and then make sure your browser is java enabled.
    cheers

  • Quick and probably easy question

    Hi all,
    I'm loading a flat file which contains 0.0000€
    How can I easily replace this in ETL with NULL?
    I tried [AMT_SALES_BONUS] = "0.0000" : NULL but having some issues.
    The AMT_SALES_BONUS is a decimal type 
    Thanks!

    Hi Yvanlathem,
    If the column is sting data type with value like this “0.0000€’, we can refer to the expression post by Visakh. If the column is decimal data type with value like this “0.0000”, we can refer to the expression post by Vaibhav.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Probably easy question

    On Tomcat, can I make subdirectories in the classes/ folder, put .class files in there, and access them like this:
    http://localhost/servlet/folder/HelloWorld
    Instead of having to declare a package and access like:
    http://localhost/servlet/folder.HelloWorld
    When i try to do it, i get a noclassdeffound error.

    You can make it to accessed as :
    http://localhost/servlet/folder.HelloWorld
    by configuring the web.xml. Tyr by putting the following in web.xml
    <servlet>
    <servlet-name>Hello</servlet-name>
    <servlet-class>folder.HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/folder/HelloWorld</url-pattern
    </servlet-mapping>

  • First-time mac user needs (probably easy) answer to question about camera

    so i got my first mac yesterday, an i-mac with the built in camera. could someone please tell me how to take pics like i took of myself when i first did the set-up? sorry if i'm a bone head and the answer is something really simple. thanks in advance!

    Welcome to Apple Discussions, grumpysmurf011
    If all you want to do is make aquick snapshot, you can use your Photo Booth application and its "Normal" effect.
    Many other applications can make also snapshots, but Photo Booth is about as simple a way as there is.
    If you are specifically asking how to change your account (set-up) picture,
    you can also do that from within  > System Preferences... > Accounts.
    Please post back and explain in different words if I have missed what you want to do.
    We will try to offer suggestions based on the details in your response.
    EZ Jim
    PowerBook 1.67 GHz w/Mac OS X (10.4.11) G5 DP 1.8 w/Mac OS X (10.5.2)  External iSight

  • Need help to probably easy question.

    Hi,  I am relatively new to computers and I have a problem.  I have an MSI 645 Ultra (MS-6547 v1) motherboard with a pentium 4 chip.  Recently, my computer can power on but I don't get any hard disk activity nor do I even get to the BIOS (the video card isn't sending any signal, and there are no POST beeps).  From looking at the user manual, I found that the USB D-Bracket has all four lights red on.  This tells me that the CPU is damaged according to the manual.  Here's my problem.  Does anyone know exactly what kind of processor I need to replace it?  I think I need a part number (the one at home is dirty and can't get any info off of it).
    Any help is greatly appreciated.

    I'll suggest testing it out with another 400watts or above CPU with 18A on +12v rail first before heading down to buy a brand new CPU.
    Trust me. Borrowing a PSU is to double confirmed the status than spending the $$$ for a workaround immediately, though it's more inconvenience to do so...

  • Migrating SQL Server DB to Oracle DB - probably EASY answer

    I completed the tutorial on migrating SQL Server DB to Oracle. When I try on my own database, it all migrated well except anything containing a datetime. When I run the oracle_ctl.bat file and view any of the log files, I see Record 1: Rejected - Error on table DBO_RIVERSIDEDB_NCWCD_TEST.TS6HOUR_TAIN, column DATE_TIME.
    ORA-01843: not a valid month. Do I need to change the first line of the file set NLS_DATE_FORMAT=Mon dd YYYY HH:mi:ssAM ? In the .dat file created from the unload_script.bat, the data starts out 1275<EOFD>2007-05-11 00:00:00.000<EOFD>74.900000000000006<EOFD><EOFD><EORD>1275<EOFD>. So my questions is about the date_format - is that the same for all SQL Server databases or do I need to enter something based on MY database? I am definitely a newbie so this is probably a super easy question. Thanks so much for any help!

    Hello,
    There are two different date format in SQL Server.
    1] DateTime : 2010-08-03 12:48:15.170
    2] SmallDateTime: 2010-08-03 12:48:00     
    Both the date will be inserted in Oracle Date column.
    Is there any automated way to generate datamove script to tackle these differences? I've around 200 tables to be migrated and there may be many such cases.
    The issue with Oracle SQL Developer setting i.e. Tools >Preferences> (Under) Migration> Data Move Option, there are two masks we can specify, one for Date Mask and other for Timestamp. How can I set both of these for converting data into Date, not in timestamp.
    Below is my .CTL file, none of below fields are timestamp, but since incoming data in in timestamp format, it is applying timestamp mask and eventually failing to insert data into table
    load data
    infile '[PARTSORDER].dat'
    "str '<EORD>'"
    into table admin.PARTSORDER
    fields terminated by '<EOFD>'
    trailing nullcols
    ORDERID ,
    GenDate "TO_TIMESTAMP(:GenDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
    Status "DECODE(:Status, CHR(00), ' ', :Status)",
    StatusBy ,
    StatusDate "TO_TIMESTAMP(:StatusDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
    Approved ,
    ApprovedBy ,
    ApprovedDate "TO_TIMESTAMP(:ApprovedDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
    TrackingNumber "DECODE(:TrackingNumber, CHR(00), ' ', :TrackingNumber)",
    SVOther "DECODE(:SVOther, CHR(00), ' ', :SVOther)",
    ShippedVia "DECODE(:ShippedVia, CHR(00), ' ', :ShippedVia)",
    ShippedBy "DECODE(:ShippedBy, CHR(00), ' ', :ShippedBy)",
    ShippedDate "TO_TIMESTAMP(:ShippedDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
    CompletedBy "DECODE(:CompletedBy, CHR(00), ' ', :CompletedBy)",
    CompletedDate "TO_TIMESTAMP(:CompletedDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
    ORDERType "DECODE(:ORDERType, CHR(00), ' ', :ORDERType)",
    RMAID ,
    RMANumber "DECODE(:RMANumber, CHR(00), ' ', :RMANumber)",
    BackOrdered ,
    XORDERID ,
    PARTSORDERSENT "DECODE(:PARTSORDERSENT, CHR(00), ' ', :PARTSORDERSENT)",
    SHIPMENTID "DECODE(:SHIPMENTID, CHR(00), ' ', :SHIPMENTID)"
    Any help in this regard will be highly appreciated!
    Thanks
    Vinod

  • Probably easy to solve

    Ok, I have made a JFileChooser, and it pop onto the screen and everything. But, when I press open I get a NullPointerException for some odd reason. But, I think it is b/c of the question I'm about to ask. If I wanted to load a picture to a JPanel would I simple just use:
    this.getImage(this.getDocumentBase(), this.getParameter()); or, would I use some other code? I know that this is probably a lame question, but I need help. Thanks.

    I've just messed about with this problem and the answer is to add a JScrollPane to the JPanel. The scrollpane then has a scrollablePicture added to it. (see the link below)
    File img = new File(<file returned from the JFileChooser>);
    ImageIcon ii = new ImageIcon(img.getAbsolutePath());
    originalPicture = new ScrollablePicture(ii, 10, imageFile, 1.0, 1.0);
    originalScrollPanel = new JScrollPane(originalPicture);
    imagePanel.add(originalScrollPanel, BorderLayout.WEST);
    If you want Scrollbars then add them. If not then don't add them. Not having the scrollbar makes the fitting of the image into the JPanel tricky.
    http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/ScrollablePicture.java

Maybe you are looking for

  • Load XML file from addon domain without cross-domain Policy file

    Hello. Assuming that there are two addon domains on the same server: /public_html/domain1.com       and      /public_html/domain2.com I try to load XML file from domain2.com into domain1.com without using cross-domain policy file (since it doesn’t wo

  • HT201822 Is there a way to improve Apple's default "ignore accidental trackpad input" function?

    I find I frequently end up typing in the wrong place and/or deleting text because the size of the trackpad leads me to touch it accidentally, usually with my right hand below the thumb. Is there any way to improve on the built in function in Lion?

  • Is a hard drive of 32 Mo/Mb Cache compatible for a  Mac pro ( before 2008)

    Bonjour, I have bought a hard drive Samsung/750 GB Sata (3,5 séries). 7200 tr.minutes. 32 mo Cache. My mac pro is a old one (before 2008). Is the 32 Mo/Mb cache compatible for my mac ? In this one i have still a Samsung hard drive of 500Gb but its ca

  • Telesales Inbound and Out bound

    Hi, Can any one please help me out with the  configuration documentation related to Inbound and Outbound Telesales which needs to done before creating Interaction Center WinClient Profiles along with configuration related CTI. Regards Vinod

  • ITUNES 12

    ever since I downloaded itunes 12 can no longer select individual podcast to my ipod nano, I can only use what itunes gives me I used to be able to select by a ck by the individual pod cast, I'm not the only one having this problem is anybody working