1.
Instance method:
Instance
method is a java method, it will be recognized and executed the moments when we
access that method.
Ex code :-
class A
{
int
i=m1();
A()
{
System.out.println("A-Con");
}
int
m1()
{
System.out.println("m1-A");
return
10;
}
}
public class Test
{
public
static void main(String[] args)
{
A
a=new A();
}
}
Output:-
m1-A
A-Con
No comments:
Post a Comment