DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    5

    For Loop and while Loop question

    Hi i'm trying to make an output that lists numbers from 1 - 100 by using for loop and while loop. Here is my coding... It doesn;t work... can some1 correct it please? thanks.

    public class Loop{

    var i
    for (int i=1; i<=100; i++){
    document.write(i +)
    }
    }

  2. #2
    Join Date
    Jul 2005
    Posts
    78
    Is that Java?

  3. #3
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    no, it's not java. var and document are from javascript. that's something different, although both have common syntax and a common name part.
    for java try the following one:
    Code:
    public class Loop{
      public static void main(String argv[]){
        for (int i=1; i<=100; i++){
          System.out.println(i+"");
        }
      }
    }
    if you're looking for javascript, this is the wrong forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links