Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Downcasting/Inheritance

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Downcasting/Inheritance

    Ok need some help. I am new to this site. So not sure best approach.

    I have a super class(Shapes), sub class(rectangle) and sub sub class (Box). I need to be able to print the shapeType for the two subclasses. I believe I need to use down casting. however I've attempted and failed!

    I am not sure best way to share code. So I think I have it attached correctly.


    help.txt

  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Downcasting/Inheritance

    Welcome john2454
    I will refer your questions to the Announcements page where you can find many useful forum tips and ask any questions you have left.
    Basically copy-paste your code to the forum within code tags (instructions on the linked page above)
    Be sure to try to explain as best as you can, what IS happening, and what you WANT to happen.
    Include the full text of any error messages with the code and question you have.

Similar Threads

  1. Help with inheritance
    By jean28 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 8th, 2012, 12:07 AM
  2. hi need help with inheritance
    By fredsilvester93 in forum Java Theory & Questions
    Replies: 2
    Last Post: July 19th, 2012, 04:01 PM
  3. Inheritance
    By lewzax in forum Object Oriented Programming
    Replies: 4
    Last Post: July 8th, 2011, 01:51 PM
  4. Is Downcasting possible in Java??
    By tcstcs in forum Java Theory & Questions
    Replies: 8
    Last Post: April 7th, 2011, 04:55 AM
  5. inheritance help
    By justin3492 in forum Object Oriented Programming
    Replies: 3
    Last Post: September 30th, 2010, 07:45 PM