Saturday, 31 August 2013

Can we call a method at class level rather than in a method [Java]?

Can we call a method at class level rather than in a method [Java]?

Can someone please tell me, how to call a method at class level?
Suppose I have a class like below, then can we call test1Method at class
level? If it is not correct please tell me the reason..
class Test2 {
Test1 t1=new Test1();
t1.test1Method();
public void test2Method() { }
}

No comments:

Post a Comment