Static

Static

  • Independent of object of that class
  • If you want to access the variable without using the object creation
  • It can only call static methods
  • it must access only static data
  • it cant refer this or super

Example
class sen
{
static int a=10;
static void test()
{
s.o.p(a);
}
}
class sen1
{
p.s.v.m(String ar[])
{
sen.test();
}
}

No comments:

Post a Comment

Loading