Please help with another card problem

this one is a strange one(if you saw the other one you might understand this better) in any case, i am getting a error and i do not see the reason
here is the code
  public Card getCard(int i)
    switch(i)
      case 1: return (Card) card1;
      case 2: return (Card) card2;
      case 3: return (Card) card3;
      case 4: return (Card) card4;
      case 5: return (Card) card5;
  }the compiler says that there is no return statement. i don not see the problem as there are five of them and all seem to be accessable.
please tell me if i am not seeing something or have it all wrong.
btw card1,card2,etc. are Card variables so that is not the problem. this method is supposed to return one of five cards according to the int that is passed to it.
please help me!

public Card getCard(int i)
switch(i)
case 1: return (Card) card1;
case 2: return (Card) card2;
case 3: return (Card) card3;
case 4: return (Card) card4;
case 5: return (Card) card5;
}No, no, no. It's really very simple. Imagine this:
Card c = getCard(42);
c.someMethod();What is the value of 'c' after calling getCard()? And what happens when c.someMethod() is called?
You see, the getCard() method does not have a return statement in all cases. A method that returns a value either must be absolutely guaranteed to execute a return statement in all cases, unless an exception in thrown.
So the simplest thing you can do (or an array of cards might be in order here) is just add a default: case that throws an exception.
   public Card getCard(int i)
     switch(i)
       case 1: return (Card) card1;
       case 2: return (Card) card2;
       case 3: return (Card) card3;
       case 4: return (Card) card4;
       case 5: return (Card) card5;
       default: throw new IllegalArgumentException("Invalid card number " + i);
Or, if you expect that in normal operation you'll be passing in values other than 1-5, instead of throwing an exception you could return null. But it sounds to me like in your case, it is a bug if a value other that 1-5 is ever passed in.

Similar Messages

  • Please help with graphic card

    hey guy i have a problem picking a graphics card that is compatible with my computer i have a pavilion a6030n specs are
    Chipset
    GeForce 6150SE nForce 430
    Motherboard
    Manufacturer: ECS
    Motherboard Name: MCP61PM-HM
    HP/Compaq motherboard name: Nettle-GL8E
    my psu is only a 300 watt i only want a card to make my desktop like a home theater hd/bluray movies no gaming i want it to support 1080p full hd and have a hdmi output. is there any card like this that i can just install with out upgrading my psu please help thanks

    Please help.  I am confused.  I have the same specs as the original poster and am also looking to upgrade my system, but i'm confused.  The video card you recommended appears to be 512MB, however, HP's specs for the motherboard state:
    Integrated graphics using nVidia GeForce 6150SE
    Up to 256MB (with 512MB or more system memory)
    Also supports PCI Express x16 graphics cards*
    So, if it says it supports up to 256MB, should i limit my search for a new video card to only ones that have 256MB, or will a 512MB one, like the one you recommened, also work?
    Thanks.

  • Please help with credit card hold question

    I just recently made my own apple id and i would like to know if apps i download will show up, by name, on the credit card hold. I want to download a free app without my parents knowing. My email is associated with the id. Please help.

    cherryqueen2 wrote:
    i had the same problem asked my company they had no answer so now what??
    No answer, what nothing at all? Surely they confirmed that you have the correct number or if it was not, they offered to supply you with a replacement card, with new security code.
    And if you have confirmed with your credit card company that the number you are using is correct, but iTunes doesn't recognise it, I'd say that was down to the credit card company and iTunes to sort it out, not you.
    It's immaterial that you were purchsing free app, you still need a valid credit card.
    Phil

  • Urgent Please help with a Conferencing problem in CUCM 6.1

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;}
    We have a configuration of CUCM 6.1. We have 24 voice ports (FXO) configured in H 323 registered with the call manger.  A CUE 3.2 configured for IVR and mail box. Gateway is a Cisco 3845 and the IOS version is 12.4(15) T10
    The problem is whenever a conference is configured with an outside number the FXO port is not releasing after the call disconnects.  It is not FXO disconnect problem. This happens only when a conference is taking place. There is no problem with any other outside or inside calls.
    I am attaching the configuration of Gateway. Please help me with the problem, I am very much thankful for you that.

    The Family pack covers upto 5 computers, other Install Disc cover one computer only.

  • Please help with an RMI problem

    Hi,
    This is probably a really simple problem which i can't spot, but i have the folloing 'HelloWorld' RMI program:
    The Client Program:
    import java.rmi.*;
    public class HelloClient {
         public static void main(String args[]) {
              if(System.getSecurityManager() == null) {
                   System.setSecurityManager(new RMISecurityManager());
              try {
                   HelloInterface obj = (HelloInterface)Naming.lookup("/HelloServer");
                   String message = obj.sayHello();
                   System.out.println(message);
                   Thread.sleep(10000);
              } catch (Exception e) {
                   System.out.println("HelloClient exception: " + e);
    }The Remote Interface:
    public interface HelloInterface extends java.rmi.Remote {
         public String sayHello() throws java.rmi.RemoteException;
    }The Server Program:
    import java.io.*;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.util.Date;
    public class HelloServer extends UnicastRemoteObject implements HelloInterface {
         public HelloServer() throws RemoteException {
              super();
         public String sayHello() throws RemoteException {
              return "Hello World, the current system time is " + new Date();
    }And finally the class which binds the object to the registery:
    import java.rmi.*;
    public class RegisterIt {
         public static void main(String args[]) {
              try {
                   HelloServer obj = new HelloServer();
                   System.out.println("Object instantiated: " + obj);
                   Naming.rebind("/HelloServer", obj);
                   System.out.println("HelloServer bound to registery");
              } catch (Exception e) {
                   System.out.println(e);
    }Now, this program works fine on my computer at home(XP!!!!!) but when i try to run it on the computers in college which run NT, it comes up with the following exceptions when i try to run RegisterIt:
    Java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    Java.lang.ClassNotFoundException: HelloServer_StubThis is saying that it cannot find the stub which is generated, but i use the folloing .bat file to load up the program:
    echo Creating remote object skelton classes....
    rmic -d . HelloServer
    start rmiregistry -J-Djava.security.policy=test.policy
    start java RegisterIt
    start java -Djava.security.policy=test.policy HelloClientThe stub is definitely created(it worked at home and i have checked in the directory and there are clearly the files HelloServer_Stub.class and HelloServer_Skel.class). The PATH is set correctly otherwise the registery would not be able to run correctly etc and therefore i am completely stuck as to why it doesn't work.
    Please help as it is very important for me.
    Many Thanks
    Cath

    I did not have any problem with Windows 2000 at all but only with Windows XP (and to think XP is a 2000 hybrid!).
    I have the same error: a ClassNotFoundException on the stub file.
    Any help will be appreciated. Thanks.

  • Please help with Nokia N95 problem.

    If anyone can help with this I’d be much appreciated, I have a N95 on contract with T-Mobile. When I try to play videos from myspace, or you tube etc… I get a message telling me the following.
    “Hello, Either you either have JavaScript turned off or an old version of macromedia's flash player click here to get the latest flash player”.
    I then get the option of clicking on a link within the previous sentence statement that directs me to acrobat downloads home page where I get the following message.
    “We are unable to locate a web player that matches your platform and browser. Please visit our table of recommended web players”
    This is deeply frustrating as in nearly every other way I feel the phone is perfect. If Any one can hep me fix this problem I’d be much appreciated.

    daperk,
    You should post this to board "Smartphones, Nseries and Eseries Devices".

  • Please help with column float problem in IE8

    Hi there,
    Sorry to be so pushy - but I am desperate for help!!
    Having serious problems with my site in some PC's showing Internet Explorer 8. My right column floated right is moving down the page underneath the left column..
    It shows fine on IE8 on my PC - however on my clients PC (vista with IE8) it is showing up as mentioned above. Is there a fix for this.
    Here is my link http://www.dooks.com/pgs/welcome.html
    The css is all there! If you need anything please let me know as I need to get this sorted - I have had serious issues with this site that I have never had before with other sites and am starting to think there is a bug in my software. I redid the index page and this one page (linked above) to see what my problems are - so help with query v appreciated.
    Many thanks,
    Karen

    Lawrence_Cramer wrote:
    A point to keep in mind is that IE8 is still in Beta.
    Not anymore.
    http://www.microsoft.com/Presspass/press/2009/mar09/03-18IE8AvailablePR.mspx
    "REDMOND, Wash. — March 18, 2009 — Today Microsoft Corp. announced the availability of Windows Internet Explorer 8, the new Web browser that offers..."
    Mark A. Boyd
    Keep-On-Learnin' :-)

  • Please Help with Graphics Card "Bait & Switch"

    I ordered a laptop for using as a field monitor and DVR with OnLocation (DV Rack) with the Quadro FX 2500M graphics card. At the last moment the builder says the Quadro is not available (or he can't afford it) and can only offer the NVidia 7950GTX or dual 7950 GTX SLI. Can anyone please help me decide whether or not to accept either one of these alternatives?
    Need to make quick decision to accept or cancel so any help much appreciated.

    Workstation cards are not really any help to the NLE user. Neither is SLI. I'd say you'll be fine with a single 7950, if you trust the guy enough to buy from him.

  • Please Help with text parsing problem

    Hello,
    I have the following text in a file (cut and pasted from VI)
    12 15 03 12 15 03 81 5 80053 1 1,2,3 $23.00 1 ^M
    12 15 03 12 15 03 81 5 84550 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 84100 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 83615 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 82977 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 80061 1 1,2,3 $44.00 1 ^M
    12 15 03 12 15 03 81 5 83721 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 84439 1 1,2,3 $44.00 1 ^M
    12 15 03 12 15 03 81 5 84443 1 1,2,3 $40.00 1 ^M
    12 15 03 12 15 03 81 5 85025 1 1,2,3 $26.00 1 ^M
    12 15 03 12 15 03 81 5 85008 1 1,2,3 $5.00 1 ^M
    this method reads the text from a file and stores it in a ArrayList
        public ArrayList readInData(){
            File claimFile = new File(fullClaimPath);
            ArrayList returnDataAL = new ArrayList();
            if(!claimFile.exists()){
                System.out.println("Error: claim data - File Not Found");
                System.exit(1);
            try{
                BufferedReader br = new BufferedReader(new FileReader(claimFile));
                String s;
                while ((s = br.readLine()) != null){
                         System.out.println(s + " HHHH");
                        returnDataAL.add(s);
            }catch(Exception e){ System.out.println(e);}
            return returnDataAL;
        }//close loadFile()if i print the lines from above ... from the arraylist ... here is waht i get ...
    2 15 03 12 15 03 81 5 80053 1 1,2,3 $23.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84550 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84100 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 83615 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 82977 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 80061 1 1,2,3 $44.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 83721 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84439 1 1,2,3 $44.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84443 1 1,2,3 $40.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 85025 1 1,2,3 $26.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 85008 1 1,2,3 $5.00 1 HHHH
    HHHH
    I see the ^M on the end of the lines ... but i dont understand why im getting the blank lines
    in between each entry ... I printed "HHHH" just to help with debugging ... anyone have any ideas why i am getting the extra blank lines?
    thanks,
    jd

    maybe its a FileReader deal.. Im not sure, maybe try using InputStreams. This code works for me (it reads from data.txt), give it a try and see if it works:
    import java.io.*;
    public class Example {
         public Example() throws IOException {
              BufferedReader b = new BufferedReader(new InputStreamReader(new FileInputStream("data.txt")));
              String s = "";
              while ((s = b.readLine()) != null) {
                   System.out.println(s);
              b.close();
         public static void main(String[] args) {
              try {
                   new Example();
              catch (IOException e) {
                   e.printStackTrace();
    }

  • Please Help with background color problem in loaded .swf

    I am stuck!
    This is Flash CS4...
    I created a flash application which loads in many other little flash applications (.swf files) based on menu selections.
    When I change one of the little applications the changes are viewable except when I change the background color.
    After the first time I view the application, the background color changes do not carry over to the main app.  I run the little ones stand alone and they show the new color, then I run the main app and any other changes I have made are there but not the color change.  When I remove the file and the load fails, the old backround color still displays in the container movie clip the .swf was previously loaded into.
    I have tried several different options and the only thing that worked was renaming and copying and deleting and making a big mess.  There has to be a way to force a refresh of this mysteriously saved color. doesn't there?
    Please help!
    Thanks!
    Vivian

    Hi Antonia
    I am loading the swf into an instance of a movie clip:
    var myLoader:MovieClipLoader = new MovieClipLoader();
    myLoader.loadClip("Capitalization.swf",  contCapitalization);
    it is the background of Capitalization.swf that will not change
    this is AS 2 since the app was created before I upgraded
    Any ideas?

  • Please help with the versioncue problem.

    I know this is not the right place to post this but please, I need fast help. When I open a project in Photoshop CS3 it says "Cannot find the missing module blablabla versioncue.dll". I've searched around a little and found someone who said that 2 updates would fix it. I downloaded the updates but when I started to install it said "Can't find the product to update".
    For some extra info, I just reformated comp and I've considered it might be something about missing files or something and if so, can someone add [email protected] and send to me because this is important. This is also because I have a schoolproject where Photoshop will be needed.
    I'm also suspicious if I actually have the documents and settings files for CS3 since I only copied the whole files from programs when I reformated it.
    Please help!

    >since I only copied the whole files from programs when I reformated it.
    you need to do a full install from the original discs david. simply copying the files won't do it.

  • Please help with my post problems

    What and how you can recover the lost e-mail in Outlook Express??? 
      Missing mail for 3 months, one day took the incoming mail on the laptop, letters have been about 2500, the next day I come to work I open mail on your computer-no mail on the laptop also lost mail. Please help to recovery pst?

    Recovery ToolBox for Outlook to PST is a specialized tool for fast and efficient recovery of user data from corrupted Outlook PST files.
    http://www.outlook.recoverytoolbox.com/

  • Can anyone please help with my G580 problems?

    These days my IdeaPad G580 has been showing serious problems: 1) I can't shut down the laptop by clicking the desktop button. Sometimes I may succeed by pushing the hardware button, but very often this won't help either. 2) I can't open the Skype app. Everytime I click on the Skype tile it just displays the blue colour for some seconds and then returns to the start menu. I have to uninstall and then install the app again. Yet the next time I try to open the app, the same problem arises. I can't just keep uninstalling and installing the app. What's more, similar problems appear when I try to open a PDF file with the windows reader application. And of course I cannot uninstall and install the reader app, so what should I do? 3) The windows app market cannot do updates. 4) I have accidentally refreshed my laptop and then I tried to restore the system. The system has been restored to a point which is exactly before I did the refreshing. So almost all my programs have been recovered - except my AUTHENTIC MS Office (which was installed with a CD-ROM)!! That's insane. But I have left my whole MS Office pack in my homeland. What can I do with this?? Please give me your feedback asap. I just bought the laptop not even a month ago. It's silly that so many problems arise.

    Have you looked under power options to see if it's configured to shut down when the button is pressed?  You can assign different actions in this menu, it may have been accidentally changed somehow.  Either that or a faulty power button?

  • Please Help with online gaming problem. Please.

    Hi. I am new to this website and I searched in the faqs but did not get much help. How do I play Age of Empires 2: Age of Kings with my cousin through online DirectPlay while the router is connected to my DSL modem? My cousin lives 9 to 10 blocks away from me and we usually use to play the game online through DirectPlay but ever since I got the router, he cannot enter my game any more. We don't play through a website or anything similar.
    Please Can someone help me.
    Info
    Computer: Windows XP Service Pack 2
    Router: WRT54G Version.8
    AT&T Yahoo DSL Modem
    Thank you for your time.

    This type of problem usually happens w/ DSL. On your PC lets try doing these steps. Open up Internet Explorer. On the address bar, just type the numbers 192.168.1.1 (username just leave it blank, password as default is admin). This should lead you to a linksys page. Go to status. On the status page, what is the Internet IP Address as listed there?

  • Please help with aiport connection problems

    Hello everyone and happy new year!!
    I bought an ibook G4 back in August 2006 everything was fine with it and working perfectly until I had a problem turning the ibook on. I rang Apple support who told me to reinstall the operating system, which I did and this fixed that problem. However, after doing this the airport card is greyed out and cannot be selected. I checked the status of the airport card and it says 'no information found'
    Does anyone know of a fix for this or would it be better to go to my apple approved store to get it looked at.
    Any help would be greatly appreciated as I love my laptop and am a bit lost without it!!!
    Thanks

    Hi again,
    I tried this fix last night but it did not work. The airport card is still greyed out and it still says 'no information found' in the airport card details (in about this mac bit).
    Hav you any other suggestions? Should I just take it to my local apple approved store to get it fixed?
    Thanks for trying to help anyway!
    ibook G4   Mac OS X (10.4.6)  

Maybe you are looking for

  • How to add command line arguments to shortcuts in the LV8.5.1 installer

    I want to create multiple shortcuts to my LV program, each with different command line arguments. I can do this manually. I want the installer to generate these shortcuts. I can add different shortcuts in de installer build specification, but I canno

  • JRA version conflict

    Hello, while trying to deploy the JRA on the 6.30 server, I encounter a version error. For the deployment of the JRA I followed the instructions in the help section of the Developer Studio. As the server did not come with the JRA installed, I copied

  • Adobe CS2 on the MacBook

    I wanted to know if my macbook (not macbook pro) can handle adobe cs2? Because this website is selling it but they says that a g5 processor is required. Do the MacBook have that? By the way, I have the black one with 2 gb's of ram http://seasofta.cn/

  • Show total sum in SAPUI5 Table

    Hi, I want to show the total of a column as a final row of the table. Need help in achieving it. Below is a mock up of what I am looking for. Right now the only thing I can think of is table footer text. But Is aligning the same with a particular col

  • Photoshop CS5 (Mac) How to load custom Smart Sharpen filter?

    Yesterday I was working with a collection of photos, and saved my Smart Sharpen settings. As I moved from one photo to another, I was able to choose my saved settings in the dropdown menu. Today, however, all that is available is "default" -- how can