Results 1 to 3 of 3
  1. #1
    ehren101 is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Default Java in eclipse JRE 6.0 not working...

    This won't work in eclipse JRE 6.0
    import java.util.scanner;
    import java.io.*;
    public class homework1 {

    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    // TODO Auto-generated method stub
    Scanner input = new Scanner(System.in);
    System.out.println("Hi, This is a program to calculate Area of a Square");
    System.out.print("What is the length of the square");
    double length = input.nextDouble();
    System.out.print("What is the width of the square");
    double width= input.nextDouble();
    double area= width * length;
    System.out.print("The area of the square is");


    System.out.println (area);


    // TODO Auto-generated method stub
    }

    }

    It gives back

    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    Scanner cannot be resolved to a type
    Scanner cannot be resolved to a type

    at homework1.main(homework1.java:11)



    Any idea?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Java in eclipse JRE 6.0 not working...

    Please don't post beginner questions in 'Advanced Java'. I've moved the thread here.

    Unresolved compilation problems:
    Scanner cannot be resolved to a type
    That's because you didn't import Scanner

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Shai-Soft©'s Avatar
    Shai-Soft© is offline ShaiSoft©
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default Re: Java in eclipse JRE 6.0 not working...

    You should import Scanner and not scanner.

Similar Threads

  1. eclipse working with few files
    By second_ffgf in forum Eclipse
    Replies: 0
    Last Post: 11-28-2011, 05:07 PM
  2. Ant and Eclipse not working??
    By dochaolic in forum New To Java
    Replies: 0
    Last Post: 11-19-2011, 01:31 AM
  3. Getting httpclient working with eclipse.
    By int80 in forum Eclipse
    Replies: 4
    Last Post: 03-31-2009, 01:17 PM
  4. JSP 2.0 not working on eclipse
    By iuna in forum Eclipse
    Replies: 1
    Last Post: 03-25-2009, 09:39 PM

Posting Permissions

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