Results 1 to 2 of 2
  1. #1
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Blog Entries
    Rep Power

    Default Question on abstract class

    Java Code:
    public abstract class MyAbstractClass{
        private int myInteger;
        public int getInteger() {
            return myInteger;
        public String print() {
    I am allowed to use "this" in an abstract class. But an abstract class is a class of which no objects can be initialized.

    How come JAVA does not "not allow" me to use "this" ? Only for the classes that extends this class ?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: Question on abstract class

    Any object of a class that extends MyAbstractClass is a MyAbstractClass, so there are objects of type MyAbstractClass.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. abstract method-abstract class
    By durgaprasad1407 in forum New To Java
    Replies: 1
    Last Post: 04-29-2011, 06:58 PM
  2. Replies: 4
    Last Post: 04-14-2011, 11:42 AM
  3. Abstract class question
    By McChill in forum New To Java
    Replies: 4
    Last Post: 02-27-2009, 06:52 AM
  4. Replies: 6
    Last Post: 02-11-2009, 10:51 AM
  5. Abstract Class question
    By maa11235 in forum New To Java
    Replies: 1
    Last Post: 01-05-2008, 10:30 PM

Posting Permissions

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