DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Posts
    3

    Post i have a porbrelm with one of my java applications

    i have been trying to make a program wich caculates your avarage age,the code i used is:
    class Age
    {
    public static void main(String[] args)
    {
    char n;
    system.out.printIn("Type in the year of your birth and press [ENTER] to find out your avarge age.");
    n =(char)System.in.read();
    system.out.printIn("The system has detected you where born in " + n);
    system.out.printIn("The system has detected your avarge age");
    system.out.print("2005 - n = " + (2005 - n));}
    }
    }

    i saved it as Age.java.

    then i compiled it in command pormt but to my confusion there was a eroer,it said:
    Age.java:12:'class' or 'interface' expected
    }
    >

    Age.java:13:'class' or 'interface' expected

    >
    2 erors

    when i typed > i mean it so its pointing upwards if you could tell me what i have done wrong i would be greatfull.
    Last edited by Goku; 08-12-2005 at 04:56 PM.

  2. #2
    Join Date
    Mar 2004
    Posts
    635
    It's

    Code:
    System.out.println()
    Capitalize System and that's an L not an I. Stands for print LINE not IN.


    You're also trying to read in a 4-digit year into a char which holds a single character.

  3. #3
    Join Date
    Aug 2005
    Posts
    3
    i see thankyou,i only have been doing java for 3days so im not so good.to make it read a four digts do i have to chagne the char to int or something like that

  4. #4
    Join Date
    Aug 2005
    Posts
    3
    yes i have solved the probelm kno thankyou

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