DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: Java 5 help?

  1. #1
    Join Date
    Nov 2004
    Location
    Montreal/Laval
    Posts
    1

    Java 5 help?

    Hello,
    I seem to be having trouble running the new enhanced loops.

    here is the set-up:
    ---------------------------------------
    java version "1.5.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
    Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)


    JAVA_HOME = C:\Program Files\Java\jdk1.5.0

    PATH = C:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.5.0\bin

    WinXP Pro
    -----------------------------------------

    Code I am trying to run:
    ------------------------------------
    public class JavaFive {

    public static void main(String[] args) {
    String[] A = new String[] {"tim","buck","too","zoo","joo"};
    --line 18---> for (String s : A){
    System.out.println(s);

    }
    }
    }

    -------------------------------------

    Error = Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    Syntax error on token(s), misplaced construct(s)
    Syntax error on token ")", : expected

    at org.redrum.tests.JavaFive.main(JavaFive.java:18)


    anyone now whats up??
    Cheers,
    Espersso /*Terry*/

  2. #2
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174
    Hi Terry,

    I have just tried your code using exactly the same JVM (1.5.0) on XP Pro and it works fine.

    This is the program I have just run

    Code:
    public class JavaFive
    {
        
        public static void main(String[] args)
        {
            String[] A = new String[] {"tim","buck","too","zoo","joo"};
            for (String s : A)
            {
                System.out.println(s);
            }
        }
    }
    I can only think that you somehow are running the wrong JVM.

    Sorry I cannot help further.
    Graham

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