Thursday 2 May 2013

What Is Different Between Instant Methods and Static Methods?


Each and every class of java contains a collection of methods the methods of java are divided into two types. They are

1. Instance methods/non static methods.

2. Static methods.


                    Instant methods
                   Static methods
1. Instance methods are those, which are recommended to perform Repeated operations such as reading the records from the file, reading records from the data base.

1. Static methods are those, which are recommended to perform. One time operation such as obtaining connection from the data base opening the file either in read mode or write mode.
2. Pro-grammatically, instance methods definition should not be preceded by a keyword.

Static

 Syntax

  Return type method name(list of formal parameter)
{
      block of statements()
}

2. Pro-grammatically, static methods definition must be preceded by a keyword static.

Syntax

  Static return type method name(list of formal parameters)

{

     Block of statements()
}



3. Each and every instances method in java must be axis with respective to object name objname instance method name.

3. Each and every static method in java must be axis with respective to class name
Class name Static method name.

4. The result of instance is not sharable.

4. The result of static method is sharable.

5. Instance method is also known as object level methods because they depend on object name and independent form class name.

Example:

Void calfot()
{

   tot=m1+m2+M3;
}
5. Static methods are also known as class level method because they depend on class name and independent on object name.

Example:

Static void main(string arrays)
{

    S1,caltotal();
   S2.caltotal();
}


6. ISR is only executed when the interrupt is trigger.



6. function is only executed when the function caller called the function.

7 function call the arguments, local  variable and return address is stored in the stack.


7. ISR after execution the current instruction the context is saved with no return value.



1 comments:

thank you very much for this difference i got a question in examination .

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More