Troubles with a switch case and final expression?

Been developing C/C++ for quite a while and still new to Java, and struggling with even the simplest things ... Why isnt this switch/case working?
have some final "variable" declared in a class contating "constants" like this ...
public class CConstants {
  public static final int MY_CONSTANT1 = 0x01;
}Now, If I'm trying to use "MY_CONSTANT1" in a case stateent, I get the error "constant expression required" ?
CConstants c = new CConstants();
switch(condition){
  case c.MY_CONSTANT1: { //do some work; break; }
  default: { }
}I thought this would be a nice idea to increase readability as there will be a long switch/case statement.
Please help!
Edited by: George.F on Sep 3, 2009 3:07 AM
Edited by: George.F on Sep 3, 2009 3:08 AM

You should refer to that constant as CConstants.MY_CONSTANT1.
Refering to it via a reference to CConstants is possible but strongly discouraged (infact I'd make CConstants non-instantiable by adding a private constructor).
Other than that your code should work.
Could you post a SSCCE that demonstrates your problem.

Similar Messages

  • Trouble with wireless switch (rfkill) and wireless connectivity.

    Hello, this is my first message in this community so please bare with me if this message should be in the newbie part; but I think it's better fitted here. Other than that, I'm glad to be here .
    After quite some time in Fedora I'm coming to Arch and I must say I'm delighted, so I wanted to use it in my laptop too which was running an old version of Fedora.
    The laptop is an Airis N930 (about 5 years old) with a RaLink RT2500 wireless adapter which worked well in Fedora 11 but I'm having some trouble getting it to work in Arch. The problem is that the connectivity switch in this laptop is kind of a software one: in Windows it's compulsory to have a program which came in the drivers disk so that when that button is pressed (think of it as another key in the keyboard) the wireless connectivity is turned on and the indicator led lights up.
    For a Linux based system there's no such program (I think) but the behaviour seems to be different in newer and older systems (I've tried Fedora and Ubuntu recent live environments and the behaviour is the same as in Arch). In Fedora 11 it just works everything's unblocked by default, in Arch the hardware block seems to be on and I don't know of any way to unblock it:
    root@laptop ~ $ ifconfig wlan0 up
    SIOCSIFFLAGS: Operation not possible due to RF-kill
    root@laptop ~ $ rfkill list
    0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: yes
    root@laptop ~ $ rfkill event unblock phy0
    1298671843.804446: idx 0 type 1 op 0 soft 0 hard 1
    Pressing the wireless connectivity button doesn't produce any event... Does anyone know what can I try or how to remove the hard block? Could it be related to newer kernels?
    Thank you very much for your time, any fixes, workarounds or ideas are welcomed.

    Thank you for your tips lamegaptop. I already have linux-firmware installed and I'm using the supported kernel module for the card (it's a PCI one):
    06:01.0 Network controller: RaLink RT2500 802.11g (rev 01)
    Loaded modules for it:
    rt2500pci 12420 0
    rt2x00pci 3890 1 rt2500pci
    rt2x00lib 24866 2 rt2500pci,rt2x00pci
    mac80211 178404 2 rt2x00pci,rt2x00lib
    cfg80211 120337 2 rt2x00lib,mac80211
    eeprom_93cx6 1004 1 rt2500pci
    Rfkill is installed too, the output I posted in the first post belongs to the commands I entered in the Arch system. In Fedora rfkill always reports both blocks to be off.
    As the Fedora system is running a 2.6.30.10 kernel I tried to run some tests using the LTS kernel (it's a 2.6.32.X right now) in the Archboot live environment, the output of "rfkill list" changed as seen below:
    $ rfkill list
    0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
    $ rfkill iwconfig
    lo no wireless extensions.
    eth0 no wireless extensions.
    wlan0 IEEE 802.11bg ESSID:off/any
    Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
    Retry long limit:7 RTS thr:off Fragment thr:off
    Encryption key:off
    Power Management:on
    $ ifconfig
    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:4 errors:0 dropped:0 overruns:0 frame:0
    TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:264 (264.0 b) TX bytes:264 (264.0 b)
    $ ifconfig wlan0 up
    $ ifconfig
    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:4 errors:0 dropped:0 overruns:0 frame:0
    TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:264 (264.0 b) TX bytes:264 (264.0 b)
    $ rfkill list
    0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: yes
    $ ifconfig wlan0 up
    SIOCSIFFLAGS: Operation not possible due to RF-kill
    This behaviour was the same when running the default Arch kernel in Archboot. I'm thinking in extracting the kernel configuration from the Fedora kernel and use it to build a new one and see if it helps, although I'm not sure where the problem may be.

  • Creating a bridge with airport extreme (base) and airport express

    i am having trouble creating a bridge with airport extreme (base) and airport express. i got the airport express to connect to my network. Airtunes sees it fine. i have an iMac (running Tiger) connected to the airport express via ethernet which i was hoping to get internet on (the iMac doesn't not have built in wireless and i had a spare airport express). now the airport express is no longer visible to the airport setup assistant on that iMac. but, like i mentioned, Airtunes is working fine, and the light is green.
    i'm new to the wireless stuff. i am sure i just missed a step. how do i get the iMac to connect to the internet via my airport express bridging to my airport extreme wireless network?
    your help is appreciated.

    You can do this with the equipment you have. Configure the AirPort Extreme base station (AEBS) to act as a WDS main base station and configure the AirPort Express (AX) to act as a WDS remote base station. That will allow you to use the Ethernet port on the AX.
    Unfortunately WDS also causes the available wireless bandwidth to be cut in half.

  • HT4623 Anyone having trouble with App Store install and cloud store buttons not working after 6.1 update?

    Anyone having trouble with App Store install and cloud store buttons not working after 6.1 update? I go to install an app. I hit install and nothing happens. About a minute later it asks me for my password and then it does nothing. The install button goes back to saying install. However the app shows up in my installed list and in cloud but no app installed.

    OK - I found a helpful post - closed app store app and under Settings/General/Date and Time I reset the date and time by switching off "Set Automatically" and then switching it on again. Went back to App Store, launched it and Updatesseems to be working again.
    Go figure? Logical, No!

  • My ipod touch will not switch on and is no longer recognised by itunes.  Before this i tried to restore it as I was having some problems with it switching off and on by itself randomly.

    My ipod touch will not switch on and is no longer recognized by itunes.  Before this i tried to restore it as I was having some problems with it switching off and on by itself randomly.
    I tried to restore it and I got error code 2009, so I closed it tried again got error code 1659, now it wont do anything and it's not recognized by my pc /itunes please help x

    For the restore error messages try:
    iTunes: Specific update-and-restore error messages and advanced troubleshooting

  • I am having trouble with the Jpeg icons and also now thumbnails not being visable in bith teh Apple finder and now also Adobe Bridge. Can anyone shed any light on this ?

    I am having trouble with the Jpeg icons and also now thumbnails not being visable in bith teh Apple finder and now also Adobe Bridge. Can anyone shed any light on this ?

    Argh - once again, I find my solution right after posting this. Left out one modification to the SWIG script, now it runs in 29 seconds vs C 16 seconds, I can live with that.

  • Trouble with iMovie '11 transitions and themes? I'm running Lion, Mac OS X and just noticed today that the transitions and themes don't seem to be working at all when I start new projects or try to add to old projects.  What is the solve here?

    Trouble with iMovie '11 transitions and themes? I'm running Lion, Mac OS X and just noticed today that the transitions and themes don't seem to be working at all when I start new projects or try to add to old projects.  What is the solve here?
    I've seen notes about clearing the cache but it seems that this is an older OS and I can't find the plist mentioned here because it's an older system.  http://www.youtube.com/watch?v=2cL9RuDV3Qc 
    Thoughts?  Anyone? 

    GUYS, I NEED HELP !
    ANYONE?

  • I had a trouble with my lap top and had to format hard disk and install all soft ware again. could any body tell me how to transfer the application and data in my i phone back to my laptop.

    I had a trouble with my lap top and had to format hard disk and install all soft ware again. could any body tell me how to transfer the application and data in my i phone back to itune.

    You can't. It still thinks that your iPhone is synced with another iTunes library (the one that you had before you reformatted the hard drive.

  • Having trouble with pop-up windows and ads for MacKeeper

    I've been having trouble with pop-up windows and ads for MacKeeper and similar "services." Tried to download "MPlayerX" a week ago and it all started then. I thought I deleted the file but I'm still having trouble. I've been digging for solutions on here, but nothing I've found on here has worked yet--the VSearch stuff (I think) isn't on my hard drive. Any advice?

    You installed a variant of the "VSearch" trojan. Remove it as follows.
    This malware has many variants. Anyone else finding this comment should not expect it to be applicable.
    Back up all data before proceeding.
    Triple-click anywhere in the line below on this page to select it:
    /Library/LaunchAgents/com.venus.agent.plist
    Right-click or control-click the line and select
              Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A folder should open with an item selected. Drag the selected item to the Trash. You may be prompted for your administrator login password.
    Repeat with each of these lines:
    /Library/LaunchDaemons/com.venus.daemon.plist
    /Library/LaunchDaemons/com.venus.helper.plist
    Restart the computer and empty the Trash. Then delete the following items in the same way:
    /Library/Application Support/venus
    /System/Library/Frameworks/v.framework
    The problem may have started when you downloaded and ran an application called "MPlayerX." That's the name of a legitimate free movie player, but the name is also used fraudulently to distribute VSearch. If there is an item with that name in the Applications folder, delete it, and if you wish, replace it with the genuine article from mplayerx.org.
    This trojan is often found on illegal websites that traffic in pirated content such as movies. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow. Never install any software that you downloaded from a bittorrent, or that was downloaded by someone else from an unknown source.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Then, still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates (OS X 10.10 or later)
    or
              Download updates automatically (OS X 10.9 or earlier)
    if it's not already checked.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • I'm having trouble with my sound up and sound down keys. They're doing other functions. This is only a new thing.

    I'm having trouble with my 'sound up' and 'sound down' keys. They're doing other functions. This is only a relatively new thing.

    You didn't mention what those "other functions" were.  That might help!
    First thing to check is System Preferences > Keyboard > Keyboard tab - make sure "Use all F1, F2, etc. keys as standard function keys" is un-checked.  Hopefully that still works in Mountain Lion.

  • Having trouble with getting on messages and facetime

    having trouble with getting on messages and facetime.  Got two new ipods, one works fine, the other keeps giving us the error: iMessage Activation Could not sign in.  Please check your network connection and try again.  We have tried to reset the factory settings, and verified that the internet is working.  Please help!

    FaceTime, Game Center, Messages: Troubleshooting sign in issues

  • HT5621 I am having trouble with my Apple ID and AppStore Here are the steps I have taken and the results: 1.     Changed my Apple ID with new email address. 2.     Changed my iCloud with above new email address. 3.     NOW - Apple ID appears correct in Ap

    I am having trouble with my Apple ID and AppStore
    Here are the steps I have taken and the results:
    Changed my Apple ID with new email address.
    Changed my iCloud with above new email address.
    NOW - Apple ID appears correct in AppStore Settings, iCloud and AppStore*
    If I scroll to bottom of screen in *App Store/Featured, I can see that the Apple ID is my new email.
    Upon “updating” Apple ID reflects OLD email.
    Deleted accounts, re-added accounts.
    Signed out and signed in with new UN/Email
    Issue remains the same.

    To migrate your data to a new iCloud account go to Settings>iCloud and turn off all synced data (contacts, calendars, etc.), when prompted choose to keep the data on your phone.  After everything is set to off, scroll to the bottom and tap Delete Account.  Next, create the new iCloud account on your phone and turn on syncing for contacts, calendars, etc again.  If prompted, choose Merge.  This will upload your data to the new iCloud account.

  • I have trouble with Firefox displaying menus and options correctly, and I keep it up to date. I have to switch to Safari to perform basic activities. What's up?

    I have Firefox 37.0.1 which I just updated on my MacBook Pro running Mac OX 10.7.5. Frequently, on web sites where I'm following directions to sign in or reset a password or do a financial transaction, like a purchase, there are menus missing from my screen. At first I blame the instructions for not being complete or accurate, but lately I've been trying to switch to another browser, like Safari. And when I do the missing menus appear! What's up? Have I missed a setting in Firefox that allows menus to appear?

    Hi LornaLyons, when I open Firefox's Web Console (Developer menu) and reload the page, only 4 files show a 404 status, the rest of the site seems fine. (Screen shot attached)
    I did reload bypassing cached files, which is Ctrl+Shift+r on Windows but probably is Command+Shift+r on Mac. Does that make any difference for you?
    Could you test the site in Firefox's Safe Mode? That's a standard diagnostic tool to deactivate extensions and some advanced features of Firefox. More info: [[Troubleshoot Firefox issues using Safe Mode]].
    ''If Firefox is not running:'' Hold down the option key when starting Firefox.
    ''If Firefox is running:'' You can restart Firefox in Safe Mode using either:
    * "3-bar" menu button > "?" button > Restart with Add-ons Disabled
    * Help menu > Restart with Add-ons Disabled
    and OK the restart.
    ''Both scenarios:'' A small dialog should appear. Click "Start in Safe Mode" (''not'' Refresh).
    Will the site load?

  • Speed issue with WDS, Airport Extreme, and Airport Express 802.11n

    I have a Airport network set up using WDS and two airport base stations: an Airport Extreme 802.11n, and an Airport Express 802.11n. The Extreme is configured to be WDS main and is connected to my cable modem and other computers, while the express is WDS relay and acts as a switch.
    I don't actually have any wireless clients connecting to the express. I'm using it to connect a mac with no airport card to the network by plugging it into the ethernet port on the express. For the most part, it works, and the mac gets a network address and can access the network. However, the connection speed from the Express to the Extreme seems slower than it should be.
    Since both are 802.11n, and the Mac is plugged into the Express's 10/100 ethernet port, I figure the theoretical top speed that the Mac should be able to communicate with another device plugged into the Extreme is at around the same speeds as 100 mbps ethernet, since the 100 mbps ethernet connection should be the bottleneck in this case. In reality, the speeds are much slower: when I transfer files between a machine connected to the extreme (via ethernet) and my mac, the speed tops out at about 2 megabytes a second, if that.
    I looked in the Airport Extreme's logs, and it indicates that the Express is only connected at 54 mbps, as though it were a 802.11g Express. I have no idea why this is! Also, the only wireless communication is between the Extreme and the Express, so one wireless device acting as a relay for another (and thus cutting the throughput in half) shouldn't be an issue.
    Does anyone know why the speeds are so slow, and if there's anything I can do to improve them?

    Hello Brian Kendall. Welcome to the Apple Discussions!
    I looked in the Airport Extreme's logs, and it indicates that the Express is only connected at 54 mbps, as though it were a 802.11g Express. I have no idea why this is!
    That is because you established a WDS which only runs in 802.11g. Since you have two 802.11n base station, you would want to take advantage of the "Extend a network" feature available with these base stations.
    Here's a typical setup:
    o If practical, place the base stations in near proximity to each other during the setup phase. Once done, move them to their desired locations.
    o Open AirPort Utility and select the base station that will connect to the Internet.
    o Choose Manual Setup from the Base Station menu, or double-click the base station to open the configuration in a separate window. Enter the base station password if necessary.
    o Click AirPort in the toolbar, and then click Wireless.
    o Choose “Create a wireless network” from the Wireless Mode pop-up menu, and then select the “Allow this network to be extended” checkbox.
    o Next, select the base station that will extend this network, and choose Manual Setup from the Base Station menu, or double-click the base station to open its configuration in a separate window. Enter the base station password if necessary.
    o Choose “Extend a wireless network” from the Wireless Mode pop-up menu, and then choose the network you want to extend from the Network Name pop-up menu.
    o Enter the base station network and base station password is necessary.
    o Click Update to update the base station with new network settings.
    (ref: Page 46 of "Designing AirPort Networks Using AirPort Utility.)

  • Networking troubles with ABIT BP6 board and Solaris 8

    Hi, Im trying to install the Solaris 8 software on my ABIT BP6 board with a Compaq NetFlex3 10TX NIC. This is a SMP board (dual celeron) but is not on the HCL (the NIC is).
    The installation gives no problems at all (except for a memory conflict between memory devices), and SunOS works pretty well except for networking... using ifconfig -a shows me the networking interface and the loopback interface but I can't ping outside of the Solaris machine (or ping to the Solaris machine from an other machine).
    I know that the board is not on the HCL but I had no networking troubles with Solaris 8 early access.
    After instalation of the software and the reboot, I get the status as below:
    >
    configuring IPv4 interfaces: cnft0.
    Hostname: MILLIWAYS
    Configuring /dev and /devices
    Configuring the /dev directory (compatibility devices)
    The system is coming up. Please wait.
    checking ufs filesystems
    /dev/rdsk/c0d0s7: is clean.
    All devices are configured...
    Configuring network interface addresses: cnft0.
    RPC: Timed out
    Starting IPv4 routing deamon.
    starting rpc services: rpcbind done.
    Setting netmask of cnft0 to 255.255.255.0
    <
    As you can see I get a time out while configuring the NIC. I tried a lot of different things (and some bad ones like using the device driver disk of the EA version with the cd's of the final version but no luck there...)
    Anyone with the same problems or any help?
    Thanx, Marcel

    Hi maeck,
    I'm sorry that my message is off the topic. Could you help me with a problem that I have with Abit BP6 + Solaris 8 combo?
    I'm encountering error message on console screen during booting/reboot/shutting down like "APIC error interrupt on CPU 0. Status=2" where CPU can be 0 or 1, status can be 0, 2, 4 or 6.
    If I let my dual Celeron400 run at 400MHz, the frequency of errors is few and far between. Though it still happens. If I overclock them to 558MHz like I udually do, it will show at least 4 times during a booting process. I've tried MPS 1.1 and 1.4 settings. I've also tried turning off all cache, delayed transaction, passive release settings.
    In addition, the overclocked system tends to lock up while it runs flawless in Windows 2000 Professional and Redhat 6.1. Do you have any similar experience?
    My system config:
    Abit BP6 motherboard
    400 MHz CPU X 2
    GlobalWin FEP32 X 2
    128M SDRAM
    Creative Labs 3DBlaster TNT2
    13GB Maxtor DiamondPlus 6800
    Acer 10x DVD drive

Maybe you are looking for

  • Poor video quality, pixelation, flickering on moving subjects in frame

    I made a quicktime movie using File>Export>Quicktime Conversion... in FCP using H.264 compression codec with best video quality and 16-bit audio. video was originally captured in miniDV. Self contianed movie was made and looked pretty good in Quickti

  • One note Crashes when opening notebook

    I have been using Onenote for about a week. I have been creating a notebook on my hard drive not Sky drive. However now when I try to open the binder. the program becomes unresponsive. The only change I did was going into the file and clicking on one

  • Compiling *.java for cfinvoke

    I'm trying to connect to a web service that uses complex-within-complex data types for its parameter. I am constantly getting errors trying to invoke the web service and it has been recommended by someone on this list (Mr. Andreyev) that I do the fol

  • Expense Report showing comma instead of period (100,00% instead of 100.00%)

    Hi, Reports in Expense Reports part of ESS is displaying comma "," instead of period ".".  I am guessing a configuration setting somewhere is set wrong.  Would someone tell me how I can correct this? Thank you. Joon,

  • Opening a page using navigateToURL

    HI, I have a page with title "Product details" on title bar.On this page I have a link which is opening another external window using navigateToURL(new URLRequest('http:/mylink.com/ProductDetailsReport.html'))" The Link page must open with title "Pro