Welcome to Dream.In.Code
Become a Java Expert!

Join 149,521 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,387 people online right now. Registration is fast and FREE... Join Now!




abstract questions

 
Reply to this topicStart new topic

abstract questions

dbrine
26 May, 2007 - 07:33 PM
Post #1

New D.I.C Head
*

Joined: 25 Apr, 2007
Posts: 48


My Contributions
I'm trying to create a abstract concrete class. I've looked around but I can't really find anything that helping me(NOOB here). I will post the code below I have already

1. need to create a abstract class. single constructor requires String to indicate the type of animal, which is stored in instance variable.

2. a few methods need to be included describe(), sound(), these will be inherited by other classes

CODE

public abstract class  Animal
{
    public Animal(String type)
    {
        super(type);
    }

    public abstract String describe()

    public abstract String sound()

    public abstract String sleep()

    public abstract String move()
}

User is offlineProfile CardPM
+Quote Post

spullen
RE: Abstract Questions
26 May, 2007 - 09:10 PM
Post #2

D.I.C Regular
Group Icon

Joined: 22 Mar, 2007
Posts: 330



Thanked: 1 times
Dream Kudos: 50
My Contributions
you have the right idea. Now on those abstract methods you need to put semicolons at the end. Also you don't use super, because you are not extending another class. Now to use the abstract class you have to extend the Animal class, so class A extends Animal (something like that). And you need to fill in the blank methods. That is the short on how to do it, there are examples on the web, just do a google search for abstract class.
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Abstract Questions
27 May, 2007 - 08:30 AM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,303



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Please do not create duplicate topics...I have deleted your other topic.
User is offlineProfile CardPM
+Quote Post

dbrine
RE: Abstract Questions
27 May, 2007 - 09:12 AM
Post #4

New D.I.C Head
*

Joined: 25 Apr, 2007
Posts: 48


My Contributions
This wasn't a duplicate. One was a concrete class question and the other was a abstract class question....?????




QUOTE(jayman9 @ 27 May, 2007 - 09:30 AM) *

Please do not create duplicate topics...I have deleted your other topic.


User is offlineProfile CardPM
+Quote Post

Jayman
RE: Abstract Questions
27 May, 2007 - 09:21 AM
Post #5

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,303



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Ok, you still could have kept them inside one post as they both pertain to the same type of topic, which is abstract classess.

I have restored the topic to the forum.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 08:29PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month