Results 1 to 2 of 2
  1. #1
    bio8855 is offline Member
    Join Date
    Nov 2011
    Rep Power

    Default Initing a Class, need a little help.

    Hello, so i am trying to initialize a class and i was wondering if anyone could give me some assistance.

    package test; public class Int extends Dec { public static void Print(Strin -

    ^ Where the main is located. ^ (

    package test; public class Dec { public class Player { private int hp; -

    ^ Where the class is. ^ (

    Sorry if i'm coding sloppily, just started using java today with a book I got from the library.

    The error is
    Description Resource Path Location Type
    No enclosing instance of type Dec is accessible. Must qualify the allocation with an enclosing instance of type Dec (e.g. A() where x is an instance of Dec). /Test/src/test line 25 Java Problem
    And is located at "Player Jim = new Player();" in;

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: Initing a Class, need a little help.

    Moderation: post "approved" and is now visible.

    Original poster, you might want to post your code in the forum rather than on an off-site as more folks will likely read the code if you do this, and so more will likely help you.


Similar Threads

  1. Replies: 0
    Last Post: 03-27-2011, 05:49 AM
  2. Replies: 5
    Last Post: 01-26-2011, 07:38 PM
  3. Replies: 8
    Last Post: 04-14-2010, 05:49 AM
  4. Replies: 7
    Last Post: 05-06-2009, 12:42 PM
  5. Replies: 8
    Last Post: 03-21-2009, 10:34 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