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

    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 - Pastebin.com

    ^ Where the main is located. ^ (Int.java)

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

    ^ Where the class is. ^ (Dec.java)

    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. x.new A() where x is an instance of Dec). Int.java /Test/src/test line 25 Java Problem
    And is located at "Player Jim = new Player();" in Int.java;

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    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.

    Luck!

Similar Threads

  1. Replies: 0
    Last Post: 03-27-2011, 05:49 AM
  2. Replies: 5
    Last Post: 01-26-2011, 06: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, 09: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
  •