Menu

Lesson 9 "Cannot use this in a sta...

2011-02-17
2013-04-09
  • Bill Swanson

    Bill Swanson - 2011-02-17

    When using scrapbook:
    ArrayList<Book> list = new ArrayList<Book>();
    Book b1 = new Book("Great Expectations");
    Book b2 = new Book("War and Peace");
    list.add(b1);
    list.add(b2);

    Person p1 = newPerson();
    p1.setName("Fred");
    b1.setPerson(p1);

    list

    I get the "Cannot use this in a static context" error message. Anny ideas?

    btw: This tutorial is beyond excellent! It is good to follow the presentation, rewind, and do it.

     
  • Bill Swanson

    Bill Swanson - 2011-02-17

    I found the error. It was a student malfunction. I put newPerson as one word instead of new Person.

     

Log in to post a comment.