Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-20-2008, 12:30 PM
Member
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0
kim85 is on a distinguished road
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] + ")");
}
}
}
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 01-20-2008, 09:43 PM
hardwired's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 1,577
Rep Power: 4
hardwired is on a distinguished road
Default
Code:
public class Test {
    public static void main(String[] args)
    {
        printDoubleArray();
    }

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

//        for (int i=0; 1 <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();
        }
    }
}
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Will this applet ever work? willemjav Java Applets 4 04-20-2008 06:40 PM
Short/Integer mew New To Java 3 12-06-2007 10:28 PM
how would i get this to work...? deeadeed New To Java 6 12-06-2007 03:58 AM
Short key for getting list of opened classes in Eclipse Java Tip Java Tips 0 12-04-2007 12:11 PM
Applet, To center text and To open I engage in a dialog in an Applet Marcus Java Applets 4 06-08-2007 07:15 AM


All times are GMT +2. The time now is 01:00 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org