DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: errrrrrror

  1. #1
    Join Date
    Dec 2003
    Posts
    1

    errrrrrror

    i writ the class below and then i want to use it at the main but can u tell me how to do that:


    public class ratio
    {

    private int d1,d2,n1,n2,num;

    public ratio()
    {
    num=d1/n1;
    if(n1%d1==0)
    {
    num=(n1/d1)/d1;
    }
    }

    public int SUM(int num1,int num2)
    {
    num1=d1/n2;
    num2=d2/n2;
    int sum =num1+num2;
    return sum;

    }


    public int MULTI(int num1,int num2)
    {
    num1=d1/n1;
    num2=d2/n2;
    int mult = num1*num2;
    return mult;
    }
    public void setx(int x){ d1=x;}

    public int getx(){return d1;}

    public void sety(int y){ n1=y;}

    public int gety(){return n1;}


    public void setz(int z){ d2=z;}

    public int getz(){return d2;}

    public void setw(int w){ n2=w;}

    public int getw(){return n2;}



    }

  2. #2
    Join Date
    Jan 2003
    Posts
    5
    You use the "main(String[] args)" to run like this:

    public static void main(String[] args) {
    Ratio ratio= new Ratio();
    //Then do whatever you want here
    }

    Hope this helps.

    Michael

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links