Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-03-2007, 02:42 PM
Member
 
Join Date: Dec 2007
Posts: 6
Lehane_9 is on a distinguished road
Absolutely Lost
xzczczczczczczczczcxcz

Last edited by Lehane_9 : 12-04-2007 at 01:50 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-03-2007, 05:37 PM
ShoeNinja's Avatar
Senior Member
 
Join Date: Oct 2007
Posts: 123
ShoeNinja is on a distinguished road
Send a message via AIM to ShoeNinja
Code:
public class Shapes { //I'm guessing these are ints since they are described as coordinates. int a,b; public Shapes(int a, int b){ this.a = a; this.b = b; } public int getA() { return a; } public int getB() { return b; } public void setA(int a) { this.a = a; } public void setB(int b) { this.b = b; } public void toPrinter(){ System.out.println("[" + a + "," + b + "]"); } } public class Orange extends Shapes { //Assuming these are ints. double radius; public Orange(int a, int b, double r){ super(a,b); this.radius = r; } public void toPrinter(){ System.out.println("[" + this.a + "," + this.b + "]" + "Radius: " + this.radius); } //this return type may need to be changed if coordinates or radius change public double getArea(){ return 3.14 * radius * radius; } public static void main(String[] args){ Orange blag = new Orange(3,4,1); blag.toPrinter(); System.out.println(blag.getArea()); } }
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-03-2007, 07:25 PM
Member
 
Join Date: Dec 2007
Posts: 6
Lehane_9 is on a distinguished road
Thank you
xczzzzzzzzzzxcz

Last edited by Lehane_9 : 12-04-2007 at 01:50 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost my javadocs orchid Eclipse 3 04-30-2008 10:45 PM
need help with program im lost lifeturn JCreator 0 02-13-2008 12:54 AM
A little lost with for loops and making a design LinxuS New To Java 5 01-22-2008 10:05 AM
Help Needed - I'm so lost adlb1300 New To Java 3 11-14-2007 02:54 AM


All times are GMT +3. The time now is 04:57 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org