Getting error and don't know why - array of objects..

Image slide[] = new Image[25];
     public SlideShow()
     for(int x = 0; x<= slide.length; x++)
          Image slide[x] = new ImageIcon("slide"+ x +"jpg").getImage();
          add(new ImageViewer(slide[x]));
     }Error:
SlideShow.java:14: ']' expected
          Image slide[x] = new ImageIcon("slide"+ x +"jpg").getImage();
                      ^
SlideShow.java:14: illegal start of expression
          Image slide[x] = new ImageIcon("slide"+ x +"jpg").getImage();

You don't need to declare the type of slide[x]. It is already known to be Image, since you declared slide as Image[]
Foo[] foos = new Foo[1];
Foo foos[0] = new Foo(); // WRONG
foos[0] = new Foo(); // RIGHT

Similar Messages

  • Keep getting error and don't know how to fix...

    ok, I keep getting this nullPointerException error.. and I have no clue what I've done wrong.... I believe its on the client side of it... because when I run just the client.. the try catch should make it be like "can't find host" but instead.. it just sits there.. the cursor blinking.. and Idk why.. so if you could please help me!!!!!!! heres the server and client code
    import java.net.*;
    import java.io.*;
    public class SocketServer extends Thread
         private static Socket socket = null;
         static boolean forever = true;
         static RTS2 rts;
         public static void main(String[] args) throws Exception
              ServerSocket serverSocket = null;
              try{
                   serverSocket = new ServerSocket(5454);
              }catch (IOException e) {
                System.err.println("Could not listen on port.");
                System.exit(1);
            Socket clientSocket = null;
             try {
                clientSocket = serverSocket.accept();
            } catch (IOException e) {
                System.err.println("Accept failed.");
                System.exit(1);
            while(forever)
                 try{
              ObjectOutputStream oos =
                            new ObjectOutputStream(socket.getOutputStream());
              oos.writeObject(rts.getCompany());
              ObjectInputStream  ois =
                           new ObjectInputStream(socket.getInputStream());
                      rts.setEnemy((Men)ois.readObject());
                      socket.close();
                 } catch (Exception e) {
                               System.out.println(e);
                               e.printStackTrace();
    import java.net.*;
    import java.io.*;
    public class SocketClient
         static boolean forever=true;
         static RTS2 rts;
         static Socket socket = null;
         static ObjectInputStream  ois = null;
         static ObjectOutputStream oos = null;
         public static void main(String[] args) throws Exception
              try {
                socket = new Socket("josh", 5455);
                ois = new ObjectInputStream(socket.getInputStream());
                   oos = new ObjectOutputStream(socket.getOutputStream());
            } catch (UnknownHostException e) {
                System.err.println("Don't know about host");
                System.exit(1);
            } catch (IOException e) {
                System.err.println("Couldn't get I/O for the connection");
                System.exit(1);
            while(forever)
                 rts.setEnemy((Men)ois.readObject());
                 System.out.println("hello");
                    oos.writeObject(rts.getCompany());
                   oos.flush();
    }

    ok so that was a silly mistake I made... yet it didn't fix the problem... whenever I run just the client, shouldn't it not find a host and not just sit there blinking? but when I do run the server then run the client I get this error from the server side
    java.lang.NullPointerException
    at SocketServer.main(SocketServer.java:32)
    which is when it starts the ObjectOutputStream and such... so I can only assume the problems on the client side, I bet its something easy too that i'm missing.. lol

  • I can't get command+j the joining option to work its giving me an error and don't know why..new at illustrator

    please help. Im in vector graphics and I'm very new to all this adobe stuff anything helps

    Caitlyn,
    You may have multiple coinciding Anchor Points at (at least) one path end. You may Direct Select the (top) Anchor Point and move it a little (preferably by a specific value) to see whether something hidden shows up; you can just Undo or move it back.
    Depending on version you may also (try to) just normally Select the two paths and Cmd+J.

  • Help!(confused face) I'm new with flash and don't know why the timers don't work like i would expect

    I'm new with flash and don't know why the timers don't work like i would expect.  In VB.NET timers are how you move stuff, but it doesn't look like they are ideal for moving stuff in flash at all (really slow).  I'm making a game in which you throw a ball around the screen. i am using a timer to get the ball to move. this doesn't work well for 2 reasons; 1: the ball jumps alot, and 2: the timer should eventually run out of time.  If anyone can help, i'd be thrilled cus this is my first post here, so yeah

    Timing for movement would be more often dealt with using something that operates at the frame rate of the file.  The ENTER_FRAME event is usually selected for this purpose.
    stage.addEventListener(Event.ENTER_FRAME, moveBall);
    function moveBall(evt:Event):void {
         // your positioning code
    You could use a Timer to control when to stop the listener from being active.

  • I have a mac os x 10.6 and don't know why I am not able to update to '09. Help please!

    I have a mac os x 10.6 and don't know why I am not able to update to '09. Help please!

    It is, but only when installed from an iWork 09 DVD(places such as Amazon and eBay may sell these) and not from the Mac App Store.
    (81103)

  • I am unable to open Organizer or Photo Editor this morning of elements 12 and don't know why.

    I am unable to open Organizer or Photo Editor in elements 12 this morning and don't know why.  Any ideas??

    OK,
    Good to hear that you are running at the moment.
    The causes for organizer and the editor to stop working are usually different. For both to be affected, I would tend to suspect disk space problems. Probably a good idea to check that you have plenty of free space.
    Please let us know if you have problems again and we can try troubleshooting.
    Brian

  • I joined this community in error and don't know how to delete myself from the group. Can someone please advise me on this ?

    I joined this community in error and don't know how to delete myself from the group. Can someone please tell me how to do that ?
    Thanks,
    Skeebo

  • Getting ORA-06502 error. Don't know why. Please help!

    I am getting the following error msgs and don't understand why?
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "SMSRPT.SP_DATA_CHECK", line 22
    ORA-06512: at line 6
    Here is my procedure. Can someone look at it and explain to me what i could possibly be doing wrong here.
    create or replace
    PROCEDURE sp_data_check(p_date number) is
    --DECLARE
    v_table_name VARCHAR2(35);
         v_string VARCHAR2(1024);
         v_result number;
         v_output VARCHAR2(1024);
    v_report_date VARCHAR2(8);
    v_dt VARCJAR2(8);
    CRLF char(2) := chr(10)||chr(13);
         CURSOR c_table is
              select table_name
              from user_tab_columns
              where COLUMN_NAME = 'REPORT_DATE'
              and table_name NOT LIKE '%BIN%';
         BEGIN
    OPEN c_table;
         loop
              FETCH c_table into v_table_name;
              exit when c_table%NOTFOUND;
              v_string:='select decode(max(report_date),'||p_date||',1,0)'|| ' from ' || v_table_name;
              execute immediate v_string into v_result;
    v_report_date:='select max(report_date)'|| ' from ' || v_table_name;
    excute immediate v_report_date into v_dt;
              v_output:=v_output||CRLF||v_table_name||': '||v_dt;
    end loop;
    if v_result =0 then
    sp_send_mail('reports@localhost','[email protected]',
    'Report Date Not There','The following tables do not have the correct report_date information:'||v_output);
    end if;
    close c_table;
    END;
    The bold section of my code is what i added that broke it. Before adding these lines of code it all worked fine.

    That worked. Here is the revised working program
    create or replace PROCEDURE sp_data_check(p_date number) is
    --DECLARE
    v_table_name VARCHAR2(35);
         v_string VARCHAR2(1024);
         v_result number;
         v_output VARCHAR2(1024);
    v_report_date VARCHAR2(100);
    v_dt VARCHAR2(100);
    CRLF char(2) := chr(10)||chr(13);
         CURSOR c_table is
              select table_name
              from user_tab_columns
              where COLUMN_NAME = 'REPORT_DATE'
              and table_name NOT LIKE '%BIN%';
         BEGIN
    OPEN c_table;
         loop
              FETCH c_table into v_table_name;
              exit when c_table%NOTFOUND;
              v_string:='select decode(max(report_date),'||p_date||',1,0)'|| ' from ' || v_table_name;
              execute immediate v_string into v_result;
    v_report_date:='select max(report_date)'|| ' from ' || v_table_name;
    execute immediate v_report_date into v_dt;
              v_output:=v_output||CRLF||v_table_name||': '||v_dt;
    end loop;
    if v_result =0 then
    sp_send_mail('reports@localhost','[email protected]',
    'Report Date Not There','The following tables do not have the correct report_date information:'||v_output);
    end if;
    close c_table;
    END;

  • My iPod nano said it couldn't download a song and don't know why

    I was downloading my MC Solar songs to my iPod and it was able to download all but one song and said it wasn't able to download it. I don't see anything different about that song and I don't know why it would download the others but not just this one song. Can anyone offer any help?

    Did it give an error message? If so what did it say?

  • Hello, I want to change my ICloud storage (to reduce it) and don't know why it doesn't allow me.. need some help!

    So 2 weeks ago I change my storage for mistake and then I realized that It was unnecesary to have 20 GB so I tried to go back with the purchase but when I put 5 GB back i can't press "OK" button.. don't know why...
    I attach an screenshot
    Tnks

    It will revert to the 5GB allowance when your current purchase ends.

  • HT3702 I have a charge of .36 on my account and don't know why

    I got a charge for .36 cents and don't know why

    To Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • I lost my HOME and REFRESH buttons and don't know why. Since I can't have them anymore please tell me in detail how I get rid of Mozilla Foxfire and let me know what all I'm going to lose in the process. Thanks, Neil

    I have used Mozilla Firefox for almost a year and it was good. Now I make on stupid mistake by upgrading to the new version and I lose my Home button, Refresh button and I don't know how many other buttons.
    Since I can't have WHAT I USED TO HAVE please explain in detail how I rid of Mozilla Firefox and what I'm all going to lose in the process.

    The home icon by default has moved to the right hand side of the navigation toolbar.
    In Firefox 4 by default the Stop, Go and Reload (Refresh) buttons are combined and attached to the right hand edge of the location bar.
    When you are typing in the location bar it will show the Go button. When a site is loading it shows the Stop button. At other times it shows the Reload button.
    If you want separate buttons stop/go/reload buttons, or want to move the home button, right-click on a toolbar and choose Customize, you can then drag and drop the buttons and place them elsewhere. If you place them in the order "Reload-Stop" on the right hand edge of the location bar they will be combined again. For more details on customizing the toolbar see https://support.mozilla.com/kb/How+to+customize+the+toolbar

  • Keyboard Event Isn't Working, and don't know why.

    I am creating a game where you have to use the up and down buttons on the keyboard to avoid movie clips. For some reason it won't register when i press the keys down.
    If anyone has any insight as to why it would be greatly appreciated.
    Here is my code:
    stop();
    var Santas:Number = 5;
    var keyDown1:Boolean = false;
    var keyUp1:Boolean = false;
    stage.focus = this;
    function randomValue()
        return Math.round(Math.random() * 500);
    stage.addEventListener(Event.ENTER_FRAME, loop);
    stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownEvent);
    stage.addEventListener(KeyboardEvent.KEY_UP, keyUpEvent );
    function keyDownEvent(myevent:KeyboardEvent)
        if (myevent.keyCode == Keyboard.UP)
            keyUp1 = true;
        if (myevent.keyCode == Keyboard.DOWN)
            keyDown1 = true;
    function keyUpEvent(myevent:KeyboardEvent)
        if (myevent.keyCode == Keyboard.UP)
            keyUp1 = false;
        if (myevent.keyCode == Keyboard.DOWN)
            keyDown1 = false;
    function loop(myevent:Event)
        score_txt.text = "Santas Left: " + String(Santas);
        cane1_mc.x +=  4;
        if (cane1_mc.x > 550 && cane1_mc.y > 0)
            cane1_mc.x = -10;
            cane1_mc.x = randomValue();
        cane2_mc.x +=  3;
        if (cane2_mc.x > 550 && cane2_mc.y > 0)
            cane2_mc.x = -10;
            cane2_mc.x = randomValue();
        cane3_mc.x +=  3;
        if (cane3_mc.x > 550 && cane3_mc.y > 0)
            cane3_mc.x = -10;
            cane3_mc.x = randomValue();
        lake1_mc.x +=  4;
        if (lake1_mc.x > 550 && lake1_mc.y > 0)
            lake1_mc.x = -10;
            lake1_mc.x = randomValue();
        lake2_mc.x +=  3;
        if (lake2_mc.x > 550 && lake2_mc.y > 0)
            lake2_mc.x = -10;
            lake2_mc.x = randomValue();
        mountain_mc.x +=  3;
        if (mountain_mc.x > 550 && mountain_mc.y > 0)
            mountain_mc.x = -10;
            mountain_mc.x = randomValue();
        if (keyDown1 && santa_mc.y > 351.10)
            santa_mc.y -=  2;
        //trace(keydown)
        if (keyUp1 && santa_mc.y < 25.10)
            santa_mc.y +=  2;
        //trace(keyup)
        if (santa_mc.hitTestObject(cane1_mc))
            Santas--;
            cane1_mc.x = -550;
        if (santa_mc.hitTestObject(cane2_mc))
            Santas--;
            cane2_mc.x = -550;
        if (santa_mc.hitTestObject(cane3_mc))
            Santas--;
            cane3_mc.x = -550;
        if (santa_mc.hitTestObject(lake1_mc))
            Santas--;
            lake1_mc.x = -550;
        if (santa_mc.hitTestObject(lake2_mc))
            Santas--;
            lake2_mc.x = -550;
        if (santa_mc.hitTestObject(mountain_mc))
            Santas--;
            mountain_mc.x = -550;
        if (Santas == 0)
            gotoAndStop(3);

    That doesn't change anything.
    Now don't know if this has anything to do with it but i have the flash layed out with 3 frames one for a intro screen and another for when you run out of lives and they both have buttons on them.

  • Sound does not sync up with the video and don't know why.

    When I converted the video's, the sound and video are perfect, but when I add them to itunes, the sound is off with the video. Anyone know why and how to fix it?

    read my post

  • Problem with uploading files to SharePoint 2013 in cloud using web services. Keep getting error message and don't know why.

    Hello everyone. I am having trouble writing a utility that uses SharePoint web services to upload a file and metatag it. It keeps throwing the following error message:
    "The request failed with the error message: -- <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="/_forms/default.aspx?ReturnUrl=%2fsites%2fgk%2f_vti_bin%2fcopy.asmx">here</a>.</h2>
    </body></html> --."
    Not sure why. I pass the file that I am going to upload to the subroutine and it is suppose to upload it to the appropriate library. I have burned several days on this problem and I am not sure what is going on. I would appreciate anyone that can point me in
    the right direction. Below is the subroutine that I have that is causing the problem. Obviously, I have stripped the name from the example.
    Thanks
    Mike
    ******** <Begin snip of code> **********************
    Public Shared Sub CreateNewDocumentWithCopyService(ByVal fileName As String)
    Dim c As New copyservice.Copy
    c.PreAuthenticate = True
    c.Credentials = New System.Net.NetworkCredential("[email protected]", "mypassword")
    c.Url = "https://x.sharepoint.com/sites/gk/_vti_bin/copy.asmx"
    Dim myBinary As Byte() = System.IO.File.ReadAllBytes(fileName)
    Dim destination As String = "https://x.sharepoint.com/sites/gk/Gatekeeper%20Reference/" & System.IO.Path.GetFileName(fileName)
    Dim destinationUrl As String() = {destination}
    Dim info1 As New copyservice.FieldInformation
    info1.DisplayName = "Title"
    info1.InternalName = "Title"
    info1.Type = copyservice.FieldType.Text
    info1.Value = "new title"
    Dim info2 As New copyservice.FieldInformation
    info2.DisplayName = "Modified By"
    info2.InternalName = "Editor"
    info2.Type = copyservice.FieldType.User
    info2.Value = "-1;#servername\\testmoss"
    Dim info As copyservice.FieldInformation() = {info1, info2}
    Dim resultTest As New copyservice.CopyResult
    Dim result As copyservice.CopyResult() = {resultTest}
    Try
    ' When creating new content use the same URL in the SourceURI as in the Destination URL argument
    c.CopyIntoItems(destination, destinationUrl, info, myBinary, result)
    Catch ex As Exception
    MsgBox(ex.Message)
    End Try
    End Sub
    ******** <End snip of code> **********************

    Hi,
    If you want to upload a file to a library in SharePoint 2013 online, I suggest you use Client Object Model or REST API.
    The code snippets in the two threads below will be helpful:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/deac7cb7-c677-47b0-acdc-c56b32dfaac8/uploading-bigger-files-using-csom
    http://stackoverflow.com/questions/17057074/how-to-download-upload-files-from-to-sharepoint-2013-using-csom
    Uploading Files Using the REST API
    http://blogs.msdn.com/b/uksharepoint/archive/2013/04/20/uploading-files-using-the-rest-api-and-client-side-techniques.aspx
    You can handle the authentication with
    SharePointOnlineCredentials object:
    http://www.vrdmn.com/2013/01/authenticating-net-client-object-model.html
    Best regards
    Patrick Liang
    TechNet Community Support

Maybe you are looking for

  • Should I use -10dBV, +4dBU or low gain for synths? Or a DI box?

    Hi Guys, I've recently purchased an RME UFX audio interface which I'm running with Logic, and I'm not quite clear which setting I should be using for synths that are coming in through the line inputs of the RME. The options are -10dBV, +4dBU or low g

  • Question related to multithreaded support in X-Fi driv

    Are there any plans for multithreaded support in X-Fi drivers?IF yes, when and for what OSes ?thanks for answers

  • USB Stick unrecognized/read only after Gparted

    Hi I partitioned a brand new USB thumb drive with Gparted and then installed Fedora LiveOS on it. This was just a test as I really wanted to use Larch to get Arch on the stick. So I tried to repartitioned it again. But Gaparted now complains that the

  • Lenovo A3500-FL Android Tablet. Won't Enrypt

    Hello. Not sure if anyone else has run into this problem, but my A3500-fl won't encrypt. It starts to reboot but that's all it does. Never encrypts, and it's keeping me from adding my work email to it.

  • Creating a button with a text label layer

    Hi guys.  Looking for any tips on how best to implement a button with a text label.  I initially created a rectangle object on a lower layer and with text in the upper layer via type tool.  When I group both objects and create the button the text is