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: Can any1 help

  1. #1
    Junior Member
    Join Date
    Aug 2021
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can any1 help

    Create an example of an overloaded method show a simple class definition for a class called MyRect,
    which defines a rectangular shape. The MyRect class must have four instance variables to define the
    upper left and lower right corners of the rectangle: x1, y1, x2, and y2.
    When a new instance of the myRect class is initially created, all its instance variables are initialized to
    0.
    define a buildRect() method ( by using Point objects rather than individual coordinates ) that takes
    four integer arguments and “resizes” the rectangle to have the appropriate values for its corners,
    returning the resulting rectangle object You can overload buildRect() so that its parameter list takes
    two Point objects (note that you’ll need to import the Point class at the top of your source file so
    Java can find it)
    To finish up this example, create a method to print out the rectangle’s coordinates, and a main()
    method to test it all

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Can any1 help

    What have you tried?
    Be sure to wrap all posted code in code tags.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Image display problem on JFrame...Can any1 help?????'
    By suyog53 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 21st, 2012, 09:26 AM