Results 1 to 2 of 2
  1. #1
    kim85 is offline Member
    Join Date
    Jan 2008
    Posts
    2
    Rep Power
    0

    Default why doesn't this short applet work?

    i was just making a simple script as a test, but it doesn't work
    i know it is simple for you guys and maybe stupid but know i want to know where the problem is.
    Do you know it?

    public class test
    {
    public static void printDoubleArray()
    {
    int[] array1 = new int[4];

    for (int i=0; 1 <4; i++)
    {
    array1[i] = i * 2;
    }
    double[] lijst = {1.4, 3.3, 6.7};

    for (int i=0; i <4; i++)
    {
    System.out.println(i + ". (" + array1[i] + ", " + lijst[i] + ")");
    }
    }
    }

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Java Code:
    public class Test {
        public static void main(String[] args)
        {
            printDoubleArray();
        }
    
        public static void printDoubleArray()
        {
            int[] array1 = new int[4];
    
    //        for (int i=0; [b][i]1[/i][/b] <4; i++)  // typo
            for (int i=0; i <4; i++)
            {
                array1[i] = i * 2;
            }
    
            double[] lijst = {1.4, 3.3, 6.7};
    
            for (int i=0; i <4; i++)
            {
                System.out.print(i + ". (" + array1[i]);
                if(i < lijst.length)
                    System.out.print(", " + lijst[i]);
                System.out.print(")");
                System.out.println();
            }
        }
    }

Similar Threads

  1. Will this applet ever work?
    By willemjav in forum Java Applets
    Replies: 4
    Last Post: 04-20-2008, 05:40 PM
  2. Short/Integer
    By mew in forum New To Java
    Replies: 3
    Last Post: 12-06-2007, 09:28 PM
  3. how would i get this to work...?
    By deeadeed in forum New To Java
    Replies: 6
    Last Post: 12-06-2007, 02:58 AM
  4. Replies: 0
    Last Post: 12-04-2007, 11:11 AM
  5. Replies: 4
    Last Post: 06-08-2007, 06:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •