dcsimg
problems with methodes difined statics.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, September 15, 2005 05:01 AM

How is it possible in JBuilder 2005 to put a non static methode in a static class? is it possible or not at all?
Thanks for your help!



Please use html tags to format code blocks.

Re: problems with methodes difined statics.

Posted By:   seetha_lakshmi  
Posted On:   Tuesday, September 20, 2005 05:58 AM

hi,


if i have understood your query properly here is the answer..

we can put non-static methods in a static class.

but we can access it only through an instance of the static class since it is non-static .



public class StaticClassTest {
public static class A { // static class
public void print(){ // non-static method
System.out.println("Hello");
}
}
public static void main(String[] args) {
A obj = new StaticClassTest.A();
obj.print();
}
}

does this answer ur question?
About | Sitemap | Contact