Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   Difference of calling methods? (https://www.askmehelpdesk.com/showthread.php?t=336105)

  • Mar 31, 2009, 05:13 AM
    almslool
    Difference of calling methods?
    hello everyone,

    I am a very beginner java user and I have some doubts:

    1- see these examples:

    Weight weightObject = new Weight();
    weightObject.getWeight();

    or

    Point myPoint = new Point();
    myPoint.setX();
    myPoint.setY();


    The above examples the method is called from an object!!!

    2- see these examples:
    String number;
    int num =Integer.parselnt(number);

    or

    JOptionPane.showMessageDialog(null,"Message", JOptionPane.ERROR_MESSAGE);

    * here JOptionPane and Integer are both classes and methodes (parselnt and showMessageDialog) are methodes called from the class


    MQ is:

    What is the difference between calling a method from an object and calling a method from the class?Why do we have these two types of methods??

    wating for your answers guys... I really need it^_^

    thanks in advance.
  • Apr 5, 2009, 10:27 AM
    Perito

    Class methods are "static" methods, as opposed to "instance" methods.

    Java: Static/Class methods
  • Apr 7, 2009, 01:58 PM
    almslool

    Thank u so much buddy

    That was very usifull

  • All times are GMT -7. The time now is 03:08 PM.