Results 1 to 3 of 3

Thread: Subclasses

  1. #1
    WillatSmu is offline Member
    Join Date
    May 2012
    Rep Power

    Default Subclasses

    Is it possible to do

    Class triangle:public shape{. .... };
    In java

    Also what would a's value in main be in this thanks

    Void Area(Int a, int b){a=a*b;}

    Public static void main(){int a=10; int b=5; area(a,b); //at this point a=? 10 or 50}

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Subclasses

    Better start here: Trail: Learning the Java Language (The Java™ Tutorials)

    When you have another question, first go through the Forum Rules and the Guide for New Users linked from there.

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    New Zealand
    Rep Power

    Default Re: Subclasses

    Quote Originally Posted by WillatSmu View Post
    Is it possible to do... what would a's value in main be in...
    The best way to answer questions like this is to write some code and run it. In a sense it's the *only* way to answer such questions, since any reply you get here leads inevitably to "but is that answer correct?".

    Java - like any programming language - is very fussy, so I would second Darryl's suggestion that you look at Oracle's Tutorial. If you have specific problems with what you find there, or if the compiler gives you messages you can't understand, or the results of your experiments are paradoxical, then you'll have a specific question to ask here.

Similar Threads

  1. Threads and subclasses
    By alkismavridis in forum New To Java
    Replies: 1
    Last Post: 11-23-2011, 08:44 PM
  2. need help with subclasses
    By thorobred in forum New To Java
    Replies: 6
    Last Post: 02-19-2011, 06:34 AM
  3. Inheritance and Subclasses
    By whateverme in forum New To Java
    Replies: 6
    Last Post: 02-10-2011, 02:47 PM
  4. Dynamic Subclasses?
    By MrFish in forum Advanced Java
    Replies: 5
    Last Post: 11-07-2010, 02:28 AM
  5. Hibernate subclasses
    By Ed in forum JDBC
    Replies: 2
    Last Post: 07-02-2007, 05:42 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