if some method is static, then you can not call that method through the oobject of that class. but the name of the class.
let us see a example:
class Test
{
int a;
int b;
static void show()
{
System.out.println("we are in show");
}
}
class Main
{
public static void main(String args[])
{
Test t=new Test();
t.show();\\thiss is an erroraneous code. because, the method "show()" is static.
Test.show();\\this is correct
}
Arnas Sinha
Copyright © 2026 eLLeNow.com All Rights Reserved.