errrrrrror


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

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

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center