Results 1 to 2 of 2

Thread: Class problem

  1. #1
    Deagel is offline Member
    Join Date
    Oct 2007
    Posts
    1
    Rep Power
    0

    Default Class problem

    I have two classes. The first is basically a notebook. The second is an array where im supposed to generate notebooks. Ive written a script generating notebooks but it doesnt work because the first class is not recognized

    notebookPile[0] = new NoteBook("Note Book" + Integer.toString(i));

    it returns saying cannot find symbol - constructor NoteBook

    How do I make it recognise the class.

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Java Code:
    class NoteBook {
        String name;
    
        public NoteBook() {
            this(null);  // or you could do: this("");
        }
    
        // Java is looking for a constructor that has
        // this signature and cannot find one in the
        // NoteBook class.
        public NoteBook(String s) {
            name = s;
        }
    }

Similar Threads

  1. problem in wrapper class
    By binoympappachen in forum New To Java
    Replies: 4
    Last Post: 12-13-2007, 12:31 PM
  2. Im new to java. how do i fix the problem with class
    By lexlukkia in forum New To Java
    Replies: 2
    Last Post: 11-18-2007, 04:47 AM
  3. Problem calling another class
    By adlb1300 in forum New To Java
    Replies: 3
    Last Post: 10-25-2007, 02:05 PM
  4. problem with date class
    By gabriel in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 01:28 PM
  5. problem with scanner class:incompatible types
    By fred in forum New To Java
    Replies: 1
    Last Post: 07-20-2007, 07:02 AM

Posting Permissions

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