You are on page 1of 6

Types of method

JAVA

Data types

1)Primitive :-

Data type size min max default

byte 1b -128 127 0


short 2b -32768 32767 0
int 4b 0
long 8b 0
float 4b 0.0
double 8b 0.0
boolean 1bit false
Types of method
char 2 byte ‘A’

* non- primitive :-

a) Not a fixed size


b)Starts with uppercase letter

Eg : - String = string S = “pranav” ;

datatype

variable name

primitive Non primitive

Fixed size Non fixed size


starts with lowercase Starts with upper case
Eg :- byte , short , int, Eg : - string, interface,
double, float , boolean
Types of method

Assignment operator

1) a+=b = a= a+b
2) a-=b = a= a-b
3) a*=b = a= a*b
4) a/=b = a= a/b
5) a%=b = a= a%b

OPERATOR

ARETHMATI
C

L0GICAL

BITWIS
Types of method

Conditional statement/ decision making/control flow


statement

If condition
If-else condition

If condition :- if(condition)
{
Statement|block of code|body
}
Types of method
1. Instance variable declared in class body outside of
the main body.
2. We can call instance variable in only non static
method.
3. We can call instance variable in main method with
the help of (Object variable name.variablename).
4. We cant call instance method in static methos.

*local/instance/stati

Local Instance Static


It is defined with the These are non static These are variable
method body or variable declerd in a decelerd
constroctor class outside any In a class outside any
method or constroctor method constroctor
using
Static key word
These variable
can not access
byhond body

Method

Business/
Types of method
regular
method
Main method
(public static void main (String[]args)

static

non-
static

You might also like