answersLogoWhite

0

Yes, we can access all methods which declare with static means then we can access..

ex:

class s{

static method()

{

System.out.println("Welcome");

}

}

class fun{

public static void main(String args[])

{

method();

}

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Why you can not use this pointer in static functions?

Because this points to the current object, but static methods don't have a current object (actually this is definition of the static methods).


What is instance method?

An instance method is nothing but a normal java method. They can be invoked only by creating an object of the class that contains the method definition. Unlike static methods that can be invoked without creating an object of the class.


How do you access the static variable and static methods of a class?

In java we access static variables and static methods without creating objects. i.e.,we can access directly by using classname we can also access static variables and static methods by using objects which are created by using class where the static variables and static methods are available


Do static methods operate on objects why?

No. Why? By definition. A static method is, precisely, a method that is not meant to operate on an object. It can only work with static fields, and other static methods, of its class.


Do methods reside within an object?

ya methods resides within an object.. because if we declare a method static it can be called by object genration.. and static variables reside in heap known as permanent genration...


Is it possible to create a static object in main?

Yes, anywhere that you can normally declare an object you can use the static keyword to make that object static.int main (){static Object o;}


What does the 'this' reference do in Java?

Represents the current object (not usable in static methods).


When should you use static method and when should we use instance method?

Non-static methods are the "normal" type of methods for a class to have. They use instance variables to perform certain actions. In other words, object A and object B of the same class may behave differently when we call one of their Non-static methods depending on the value of their instance variables. Static methods on the other hand behave the exact same way for all instances of a class. object A and B of the same class will act in the same way when we call one of their Static methods. (*NOTE* Static methods cannot use instance variables)


What is diffrent between object pointer and this pointer?

'this' is an object-pointer: it points to the current object (usable only in non-static methods).


What is need of static method?

If you need to access a method without creating an object of corresponding class, it need to be a static method.


Can you overload static methods in Java?

Yes you can overload the static method. But it should be avoided because memory to static methods are allocated at the time of class load.....so memory will be wasted if we don't use that methods. Whereas non-static method memory allocation depends on Object


What is need for static method?

Static methods are methods that can be invoked without creating an instance of the class that contains them. They are needed in cases where the programmer would not want to create multiple instances of a class to execute a method.