please help: simple java coding error 'cannot be referenced from a static context'

Discussion in 'General Computer Support' started by clm90, Oct 17, 2009.

  1. clm90

    clm90

    Joined:
    Oct 17, 2009
    Messages:
    1
    Im trying to read in a string through console and store the two distinct words into two different variables. I've tried a number of ways but keep getting errors that i dont know how to solve. could someone help please?
    heres the code (i deleted some parts i thought irrelevant)


    public class Contact extends Person
    {
    static Scanner console = new Scanner (System.in);

    private Address address;
    private Date dob;
    private String phoneNumber;

    Contact contactTest = new Contact();

    /**
    * Constructor;
    */

    public Contact(Scanner input, boolean prompt)
    {
    String firstName = "";
    String lastName = "";


    if (prompt==true)
    {

    System.out.println("Enter first and last name");
    firstName = contactTest.Scanner.next();
    lastName = contactTest.Scanner.next();


    ________________

    So far i have tried a)firstName = Scanner.next(); and b) the code just above.
    the error list i get is:

    1. a)cannot find symbol constructor Contact();
    2. a) cannot find variable Scanner
    3. B) (nonstatic method cannot be reference from s static context
     
    clm90, Oct 17, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eirlys

    Referenced memory help,please?

    Eirlys, May 26, 2004, in forum: Computer Support
    Replies:
    10
    Views:
    1,120
    @}-}-------Rosee
    May 27, 2004
  2. t-rex
    Replies:
    5
    Views:
    22,767
    j_iliz
    Mar 16, 2008
  3. t-rex
    Replies:
    0
    Views:
    727
    t-rex
    Mar 19, 2005
  4. UriSchneider@gmail.com

    help - error 0x022c367e referenced memory 0x000000

    UriSchneider@gmail.com, Sep 21, 2006, in forum: Computer Support
    Replies:
    1
    Views:
    798
    Jerry Attic
    Sep 21, 2006
  5. javnewbie
    Replies:
    0
    Views:
    2,681
    javnewbie
    Jan 2, 2010
Loading...

Share This Page