You are on page 1of 3

Method Types Defination

Method is representation of group of


statement.Most of implementation have
happned through Methods .

Whenever execution starts in the class which


Static are static are loaded in memory .

This method does not have keyword static


Non Static before the name of the method

Variable is the name of storage location .


It is accessible with program at runtime edit.
Variables

It creates within the method body .


Local Variable Scope is within the method body

It must be created outside the method body


Static /Class Variable and inside the class body

Each object wise non static variables gets


Non static/Instance Variable the new memory location
Calling Syntax Return Type Main Method

1. Return Type is not void


2.In method declaration return type must be other
than void
1.With Object Reference 3.In the method body last statement must be return
2.with classname reference statement Call method from
3.With static Method name only 4. Get the return value with method call statement other than main
withing the class returntype variable =Method call statement method

1.With non void as returntype


2. In method declaration return type must be other
than void .
1.With Object Reference 3. In the method body last statement must be return
2.Within the class call the non static statement . Call method
method with method name from non 4.Get the return value with method call statement should be from
static method only returntype variable =Method call statement main

1.with object reference


2.with classname reference
3.with static variable name within the
class.
4.Static variable is having single
memory reference

1. with object reference


Keyword Memory Allocation

1.Performance Issue,Static
method are available in
1.Method must have static keyword runtime memory
before method name . 2. Memory Allocation
2.We can not use this keyword inside happens only Once
a static method . 3.Less memory is Used

THIS -keyword used only in Non static 1.Memory is allocated


method. everytime when the method
For this keyword no object creation is is called .
required 2.Much memory is used

You might also like