1. why is not a constant 2. put reference

Hello!
I have two questions.
1. It is 2 classes - A and B. In A I define variable:
final int number = 1;
In class B ( I create it so - B(A aa) ) I try to use this variable:
case aa.number: .... - And I receive compilation error in this string - "constant expression required". Why variable number don't accepted as constant?
2. And my second problem. I have some classes CreateTab, TabModel, MainProg. MainProg call CreateTab, CreateTab uses TabModel for creation JTable, class TabModel extends AbstractTableModel. In MainProg I define an array:
Object [][] tabData = { {"", "", ""} };
This array is used in TabModel :
private Object [][] data = mp.tableData;
Who can hint me how I have to put reference of tabData from MainProg to TabModel? I understanded that constructor TabModel don't use in this case - I tried to do so:
in MainProg: new CreateTab(this),
in CreateTab: TabModel tm = TabModel(mainProg);
in TabModel: TabModel (MainProg mainProg) {
mp = mainProg;
private Object [][] data = mp.tableData; but in this string I receive "Null pointer exception".
What do I do incorrectly?
Thanks.

Your variable mp hasn't been set when that line is encountered.
If I understand you correctly, your code is like
class TabModel extends AbstractTableModel {
    private MainProg mp;
    private Object [][] data = mp.tableData;
    TabModel (MainProg mainProg) {
        mp = mainProg;
}The assignment to data happens before the assignment to mp; when your constructor is invoked, before
executing any code in the constructor itself, member initialization will occur. At that point, the member
variable has not been set yet. You could instead do
class TabModel extends AbstractTableModel {
    private MainProg mp;
    private Object [][] data;
    TabModel (MainProg mainProg) {
        mp = mainProg;
        data = mp.tableData;
}: jay

Similar Messages

  • Why isnt my itouch not connecting to the wifi? everytime i try to conncect to a network and then i put in the password, it says unable to connect to this network! why is not working?????????? someone please help me!!!

    Why isnt my itouch not connecting to the wifi? everytime I try to connect to a network and i put in the password it says "unable to connect to this network" why isnt working?! the password is correct and everything. I just dont understand why its not working. Someone please help me! thanks

    Did it ever work with this WiFi system?
    Do other devices work with this WiFi system?

  • HT5312 Your security questions do not match what I put in when I opened the account, why can't I get security questions that have my answers?

    Your security questions do not match what I put in when I opened the account, why can't I get security questions that have my answers?

    From a Kappy  post
    The Three Best Alternatives for Security Questions and Rescue Mail
       1. Use Apple's Express Lane.
    Go to https://expresslane.apple.com ; click 'See all products and services' at the
    bottom of the page. In the next page click 'More Products and Services, then
    'Apple ID'. In the next page select 'Other Apple ID Topics' then 'Forgotten Apple
    ID security questions' and click 'Continue'. Please be patient waiting for the return
    phone call. It will come in time depending on how heavily the servers are being hit.
    2.  Call Apple Support in your country: Customer Service: Contact Apple support.
    3.  Rescue email address and how to reset Apple ID security questions.
    A substitute for using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • I purchased songs from 2 different computers using itunes with the same apple id. I had 1 iPod I used for these but I just recently got an iPhone and I was wondering why it wasn't letting me put my purchased songs on my iPhone?

    I purchased songs from 2 different computers using itunes with the same apple id. I had 1 iPod I used for these but I just recently got an iPhone and I was wondering why it wasn't letting me put my purchased songs on my iPhone?

    You can transfer iTunes content from an iTunes library on a single computer only.
    Since these songs were purchased with the same iTunes account, you can download the song that is not in your iTunes library on the computer you will be syncing your iPhone with. Or you can download the song or songs direct on your iPhone.
    http://support.apple.com/kb/HT2519?viewlocale=en_US&locale=en_US

  • I bought music on my ipod touch. Why is it that I cannot put that music on my other ipod(s)?

    Hello,
    I bought music on my iPod touch. Why is it that I cannot put that music on my other Ipod(s)?
    I downloaded my IPodTouch to my computer with no problems. I tried to drag the music I bought on my IpodTouch to other playlists on my computer and it did not let me. It refuses to let me even try to drag it to my computer music Library. It shows on my IPodTouch, but like I said, it will not let me drag it to my other Ipod(s) or even to my Music Library on my computer. Please help me.

    Aurthorise / Deaurthorise About
    http://support.apple.com/kb/HT1420
    Apple ID FAQ
    http://support.apple.com/kb/HE37

  • Why is the Space Constant so slow?

    Obviously I'm asking comparatively since they are faster then the blink of an eye.
    When trying to optimize some of my functions I've noticed that this one constant is really slow.
    Here's my test VI: I simply am measuring the time it takes to append a character to a string. If the string doesn't exist, don't add anything. This also prevents the compiler from optimizing out the for loop.
    Most cases I've averaged about 250 ms. However, if I used the space constant instead of putting a space character in a string constant. It nearly 10-fold the time it takes to nearly 2.1 seconds.
    So I question why is this the case? I don't see why all the other constants (I checked) run at full speed, but the space constant (which I can see it's block diagram) takes significantly longer. Is this a bug?
    Attachments:
    Space Timing.vi ‏14 KB

    bsvare wrote:
    As for being flawed. I wanted it to be. I don't want my for loop to be folded away. This simple test VI is so simple that it takes literally 10 million runs to have reasonible run time for compairison. If you fold it away to a single run, you can't see the effects.
    Well, it is flawed in the wrong way, because most likely the presence of a subVI will cause more complicated debugging code and the effect might be secondary. You could e.g. eliminate folding by e.g. doing a comparison of "[i] != 0" or "[i] AND 1" for the case decision. Now all variantions seem to be about the same speed (with or without debugging, resp., where debugging poses a large penalty).
    LabVIEW Champion . Do more with less code and in less time .

  • Plz help why its not compiling ,

    hello all i am trying to make the tutorial http://developers.sun.com/mobility/midp/articles/tutorial2/
    i have made all the steps once i try to compile it it shows the folowing error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Wrapper cannot find servlet class HitServlet or a class it depends on
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:836)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:613)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:164)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    etc.....
    i believe the error has something to do with my classpath thats why its not compiling the HitServlet.java
    if anybody can show me plz how to make this following step :
    Compiling the Servlet
    Compiling servlet code is pretty much the same as for other Java development, except for an important twist. Because the servlet API is not a core part of the Java SE platform, you'll need to add it to your CLASSPATH before you can compile servlets.
    The servlet API is contained in common/lib/servlet.jar under the Tomcat root directory. Simply add this file to your CLASSPATH and you will be able to compile HitServlet.java using javac. You can edit the CLASSPATH in the system properties or do it on the command line, as this Windows example demonstrates:
    C:\>set CLASSPATH=\jakarta-tomcat-4.1.31\common\lib\servlet.jar
    C:\>javac HitServlet.java
    i have installed the tomcat and its working fine but i dont understand how to set the classpath , i tried to make it in control panel / system / envirement and put the classpath but its still doesnt work
    please help on what i should make in my classpath and how to set it to work if not please notify me where am i making mistake thank you
    appreciate a lot help

    hello all i am trying to make the tutorial http://developers.sun.com/mobility/midp/articles/tutorial2/
    i have made all the steps once i try to compile it it shows the folowing error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Wrapper cannot find servlet class HitServlet or a class it depends on
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:836)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:613)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:164)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    etc.....
    i believe the error has something to do with my classpath thats why its not compiling the HitServlet.java
    if anybody can show me plz how to make this following step :
    Compiling the Servlet
    Compiling servlet code is pretty much the same as for other Java development, except for an important twist. Because the servlet API is not a core part of the Java SE platform, you'll need to add it to your CLASSPATH before you can compile servlets.
    The servlet API is contained in common/lib/servlet.jar under the Tomcat root directory. Simply add this file to your CLASSPATH and you will be able to compile HitServlet.java using javac. You can edit the CLASSPATH in the system properties or do it on the command line, as this Windows example demonstrates:
    C:\>set CLASSPATH=\jakarta-tomcat-4.1.31\common\lib\servlet.jar
    C:\>javac HitServlet.java
    i have installed the tomcat and its working fine but i dont understand how to set the classpath , i tried to make it in control panel / system / envirement and put the classpath but its still doesnt work
    please help on what i should make in my classpath and how to set it to work if not please notify me where am i making mistake thank you
    appreciate a lot help

  • While printing, why does PE11 crop the out put?

    While printing, why does PE11 crop the out put?

    Did you crop the photo to the same aspect ratio as your print size? If not, then the software will crop it for you.

  • Why does Notes close every time I open it?   I can't access my notes...

    Why does Notes close every time I open it?   I can't access my notes;
    there don't appear to be any.    Help!
    When I check in Settings, Notes has disappeared from the list of Apps
    On my iPhone, yet I didn't delete it.    I had dozens of notes, lots
    of necessary information stored therein. 
    Thanks for any help....

    I was having this issue also. I found this thread and disabling Exchange Notes did the trick. Obviously, this is the solution only if you were using Exchange to begin with.
    If you want to continue to use Exchange notes or perhaps try this to see if it works in general, I found a fix on this site. All works well now.
    1. Delete your exchange account from the Mail, Contacts & Calendars pane in System Preferences.
    2. Go to Finder, click "Go" in the menu bar, click "Go to Folder" and type in "~/Library" (without the quotes) in the box. This will take you to your user Library folder.
    3. Use the search box in the finder and type in "com.apple.notes" and click "Library" in the search bar that appears. This should now find several folders and files related to the Notes app. Rename or delete everything except the help files (with the lifesaver icons on them).
    4. Restart your Mac. Put your exchange account back into System Preferences, you can go ahead and activate the Notes sync service.
    5. Open Notes and it should be working now!

  • Why Java not allowed Widening and auto-boxing in single expression?

    Hi All,
    I have a very small question in my mind, that I would like to put on this discussion board.
    Why Java not allowed Widening and auto-boxing in single expression?
    Like:
    short s = 10;
    Long l = s;I want to know if java allowed above expression then what problem may occur?
    I know it is not a intelligent question, However still I ask for discussion.
    Thanks advance for all viewer of this question.

    JoachimSauer wrote:
    jverd wrote:
    I didn't like it at first, but it turns out my initial complaints were pretty much unfounded. I find it quite useful. It takes a fair amount of clutter out of code. The only real problem with it is that if you're not careful, you can end up doing a lot of unnecessary bouncing back and forth between primitives and wrappers without knowing it, which could hurt performance.In my opinion the biggest problem is getting NPEs at code lines, that look completely harmless. That used to bother me too, but then, if I'm writing
    int i = getAnInteger();it's just a replacement for
    int i = getAnInteger().intValue();which would also have caused NPE.
    That is, if I'm using autoboxing properly, it's just shorthand for what I'd have been doing otherwise anyway. True, it's easy to not think about it, to forget to consider whether NPE is a possibility and what the proper approach is, but mostly, if I want int, I know it can't be null (or if it is, I should get NPE).
    And when it comes time to debug the NPE, it's no great mystery, once you know the rules.
    If you don't think of autoboxing at the right position, then you can spend hours after hours tracking down a trivial bug ... or so I've heard ;-)Even if you're not thinking about it when you write the code, when you see an "impossible" NPE during debugging, it should be an instant giveaway.

  • Why do not Apple send a fix for all fail´s / slow mac`s afther upgrade to Yosemite

    I have upgrade 2 of my Macbook air 11" models. Both have major slow functionality in allmost every programs. slow mail, safari, pages. Allmost nothing of the funksjonalitys can being uses in numbers. Slow functionality when jumping between programs. Allover i have BIG problems with mac for my first time. And why do not Apple send a fix for all fails there is after upgrading to Yosemite. When thousand of users have the same problem with major slow mac`s.
    Here is a test for my mac.
    EtreCheck version: 2.1 (101)
    Report generated 4. desember 2014 kl. 22.48.33 CET
    Hardware Information: ℹ️
      MacBook Air (Verified)
      MacBook Air - model: MacBookAir6,1
      1 1.7 GHz Intel Core i7 CPU: 2-core
      8 GB RAM Not upgradeable
      BANK 0/DIMM0
      4 GB DDR3 1600 MHz ok
      BANK 1/DIMM0
      4 GB DDR3 1600 MHz ok
      Bluetooth: Good - Handoff/Airdrop2 supported
      Wireless:  en0: 802.11 a/b/g/n/ac
    Video Information: ℹ️
      Intel HD Graphics 5000 -
      Color LCD 1366 x 768
    System Software: ℹ️
      OS X 10.10.1 (14B25) - Uptime: 0:12:8
    Disk Information: ℹ️
      APPLE SSD SM0512F disk0 : (500,28 GB)
      S.M.A.R.T. Status: Verified
      EFI (disk0s1) <not mounted> : 210 MB
      Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
      Macintosh HD (disk1) / : 496.30 GB (371.41 GB free)
      Core Storage: disk0s2 499.42 GB Online
    USB Information: ℹ️
      Apple Inc. BRCM20702 Hub
      Apple Inc. Bluetooth USB Host Controller
    Thunderbolt Information: ℹ️
      Apple Inc. thunderbolt_bus
    Gatekeeper: ℹ️
      Mac App Store
    Kernel Extensions: ℹ️
      /Applications/Parallels Access.app
      [not loaded]  com.parallels.virtualsound (1.0 18 - SDK 10.6) [Support]
      /Applications/Parallels Desktop.app
      [not loaded]  com.parallels.kext.hypervisor (10.1.1 28614 - SDK 10.7) [Support]
      [not loaded]  com.parallels.kext.netbridge (10.1.1 28614 - SDK 10.7) [Support]
      [not loaded]  com.parallels.kext.usbconnect (10.1.1 28614 - SDK 10.7) [Support]
      [not loaded]  com.parallels.kext.vnic (10.1.1 28614 - SDK 10.7) [Support]
      /Library/Application Support/Kaspersky Lab/KAV/Bases
      [not loaded]  com.kaspersky.kext.kimul.38 (38) [Support]
      /Library/Extensions
      [loaded]  com.silex.driver.sxuptp (1.10.9 - SDK 10.8) [Support]
      /System/Library/Extensions
      [not loaded]  com.devguru.driver.SamsungComposite (1.2.61 - SDK 10.6) [Support]
      [not loaded]  com.freecom.driver.BoulderScsi (1.0.0d1) [Support]
      [not loaded]  com.kaspersky.kext.klif (2.2.1d19) [Support]
      [not loaded]  com.zg.driver.ZGUSBCDCACMData (1.5) [Support]
      [not loaded]  com.zg.driver.ZGUSBMassStorageFilter (1.5) [Support]
      [not loaded]  com.zg.driver.cdc_ecm_qmi (1.9) [Support]
      [not loaded]  com.zg.driver.cdc_usb_bus (1.9) [Support]
      /System/Library/Extensions/ssuddrv.kext/Contents/PlugIns
      [not loaded]  com.devguru.driver.SamsungACMControl (1.2.61 - SDK 10.6) [Support]
      [not loaded]  com.devguru.driver.SamsungACMData (1.2.61 - SDK 10.6) [Support]
      [not loaded]  com.devguru.driver.SamsungMTP (1.2.61 - SDK 10.5) [Support]
      [not loaded]  com.devguru.driver.SamsungSerial (1.2.61 - SDK 10.6) [Support]
    Launch Agents: ℹ️
      [running]  com.brother.LOGINserver.plist [Support]
      [loaded]  com.google.keystone.agent.plist [Support]
      [loaded]  com.oracle.java.Java-Updater.plist [Support]
      [running]  com.parallels.mobile.prl_deskctl_agent.launchagent.plist [Support]
    Launch Daemons: ℹ️
      [loaded]  com.adobe.fpsaud.plist [Support]
      [loaded]  com.google.keystone.daemon.plist [Support]
      [failed]  com.kaspersky.kav.plist [Support] [Details]
      [loaded]  com.macpaw.CleanMyMac2.Agent.plist [Support]
      [loaded]  com.oracle.java.Helper-Tool.plist [Support]
      [loaded]  com.oracle.java.JavaUpdateHelper.plist [Support]
      [running]  com.parallels.mobile.dispatcher.launchdaemon.plist [Support]
      [failed]  com.parallels.mobile.kextloader.launchdaemon.plist [Support] [Details]
    User Launch Agents: ℹ️
      [running]  ca.indev.MailTagsHelper.agent.plist [Support]
      [loaded]  com.facebook.videochat.[redacted].plist [Support]
      [loaded]  com.genieo.completer.download.plist Adware! [Remove]
      [loaded]  com.genieo.completer.ltvbit.plist [Support]
      [running]  com.genieo.completer.update.plist Adware! [Remove]
      [not loaded]  com.macpaw.CleanMyMac.helperTool.plist [Support]
      [not loaded]  com.macpaw.CleanMyMac.trashSizeWatcher.plist [Support]
      [not loaded]  com.macpaw.CleanMyMac.volumeWatcher.plist [Support]
      [loaded]  com.macpaw.CleanMyMac2Helper.diskSpaceWatcher.plist [Support]
      [loaded]  com.macpaw.CleanMyMac2Helper.scheduledScan.plist [Support]
      [loaded]  com.macpaw.CleanMyMac2Helper.trashWatcher.plist [Support]
      [loaded]  com.parallels.mobile.startgui.launchagent.plist [Support]
    User Login Items: ℹ️
      iTunesHelper  ProgramHidden (/Applications/iTunes.app/Contents/MacOS/iTunesHelper.app)
      fuspredownloader  ProgramHidden (/Users/[redacted]/Library/Application Support/.FUS/fuspredownloader.app)
    Internet Plug-ins: ℹ️
      JavaAppletPlugin: Version: Java 7 Update 71 Check version
      FlashPlayer-10.6: Version: 15.0.0.239 - SDK 10.6 [Support]
      Default Browser: Version: 600 - SDK 10.10
      NP_2020Player_IKEA: Version: 5.0.94.1 - SDK 10.6 [Support]
      Flash Player: Version: 15.0.0.239 - SDK 10.6 [Support]
      QuickTime Plugin: Version: 7.7.3
      nplastpass: Version: 3.1.61 [Support]
      JavaPlugin2_NPAPI: Version: Unknown
      Silverlight: Version: 5.1.30514.0 - SDK 10.6 [Support]
      iPhotoPhotocast: Version: 7.0
    userinternetplugins ℹ️
      Google Earth Web Plug-in: Version: 7.1 [Support]
    Safari Extensions: ℹ️
      Facebook Cleaner
      Pin It Button
      LastPass
      ResizeMe
      OpenIE
    3rd Party Preference Panes: ℹ️
      Cineform  [Support]
      Flash Player  [Support]
      Java  [Support]
    Time Machine: ℹ️
      Mobile backups: ON
      Auto backup: YES
      Volumes being backed up:
      Macintosh HD: Disk size: 496.30 GB Disk used: 124.90 GB
      Destinations:
      Data [Network]
      Total size: 3.00 TB
      Total number of backups: 65
      Oldest backup: 2013-08-15 20:20:51 +0000
      Last backup: 2014-12-04 17:20:31 +0000
      Size of backup disk: Excellent
      Backup size 3.00 TB > (Disk size 496.30 GB X 3)
    Top Processes by CPU: ℹ️
           4%  WindowServer
           1%  fontd
           1%  cloudd
           0%  Safari
           0%  launchd
    Top Processes by Memory: ℹ️
      369 MB  com.apple.WebKit.WebContent
      155 MB  Safari
      103 MB  Feedback Assistant
      86 MB  Finder
      69 MB  mds_stores
    Virtual Memory Information: ℹ️
      4.52 GB  Free RAM
      2.60 GB  Active RAM
      652 MB  Inactive RAM
      820 MB  Wired RAM
      1.04 GB  Page-ins
      0 B  Page-outs
    Diagnostics Information: ℹ️
      Dec 4, 2014, 10:37:00 PM  Self test - passed

    [loaded]  com.genieo.completer.download.plist Adware! [Remove]
      [loaded]  com.genieo.completer.ltvbit.plist [Support]
      [running]  com.genieo.completer.update.plist Adware! [Remove]
      [not loaded]  com.macpaw.CleanMyMac.helperTool.plist [Support]
      [not loaded]  com.macpaw.CleanMyMac.trashSizeWatcher.plist [Support]
      [not loaded]  com.macpaw.CleanMyMac.volumeWatcher.plist [Support]
      [loaded]  com.macpaw.CleanMyMac2Helper.diskSpaceWatcher.plist [Support]
      [loaded]  com.macpaw.CleanMyMac2Helper.scheduledScan.plist [Support]
      [loaded]  com.macpaw.CleanMyMac2Helper.trashWatcher.plist [Support]
    Your machine is slow because you loaded a bunch of third party junk on it.

  • HT204053 why are not all my songs I have purchased in the itunes store and are on my computer not on my phone?

    why are not all my songs I have purchased in the itunes store and are on my computer not on my phone?  Very frustrating I purchaed almosta $100 worth of songs for a trip and they are not on my phone after continuious syncs.  Do I have to pay for itunes match for this?

    Welcome to the Apple Community.
    Have you actually selected them to be synced to your device from the iTunes sync settings.

  • I want to reset my privacy questions for my apple i.d. But when i request to do so it sends it to a email address that isnt on my file can anyone tell me why its not working?

    I want to reset my privacy questions for my apple i.d. But when i request to do so it sends it to a email address that isnt on my file can anyone tell me why its not working?

    1)  Apple ID: All about Apple ID security questions
    Torrifromny wrote:
    I want to reset my privacy questions for my apple i.d. But when i request to do so it sends it to a email address that isnt on my file ?
    2)  See Here.  Apple ID: Contacting Apple for help with Apple ID account security
    Ask to speak with the Account Security Team...
    3)  Or Email Here  >  Apple  Support  iTunes Store  Contact

  • I have an apple id but ı can not use it for sign in to itunes connect account while publishing my ibook document. Why ı can not login? What can ı do to figure out this problem?

    I have an apple id but ı can not use it for sign in to itunes connect account while publishing my ibook document. Why ı can not login? What can ı do to figure out this problem?

    As note already on the iBA forum [ AppleID for ibooks publishing ], you need two IDs. You can't use your developer ID.
    If you already signed up for books with that ID, you need to talk to Apple to straighten things out.

  • Hi! I went to the new Apple new shop and I was looking for a dock station/ speakers for ipod. Why is not possible to listen the models not in exhibition?! How can I decide?! Just the design?! It's stupid!

    Hi! I went to the new Apple new shop and I was looking for a dock station/ speakers for ipod. Why is not possible to listen the models not in exhibition?! How can I decide?! Just the design?! It's stupid!

    Hi! I went to the new Apple new shop and I was looking for a dock station/ speakers for ipod. Why is not possible to listen the models not in exhibition?! How can I decide?! Just the design?! It's stupid!

Maybe you are looking for