what happens when a static method calls a static method with respect to object name if those two static methods are in same class..?
what happens when a non-static method calls a static method directly(if those two static and non-static methods are in same class..)..?
StaticMethodBhupesh Sharma June 15, 2012 at 12:46 AM
i don't see any use of these variables :
i=100;
j=1000;
it's just that you have to declare a variable static if you want to use that variable in the static method.
it might be confusing if you see the code of this particular Example.
commentsdhananjay singh shrinet July 10, 2012 at 3:16 PM
class Csm
{
public static void doIt()
{
System.out.println("Am IN doIt();");
}
}
class StaticMethodDemo
{
public static void main(String ar[])
{
Csm obj1=new Csm();
obj1.doIt();
Csm.doIt();
obj1=null;
obj1.doIt();
}
}
/*OUT PUT:
D:\java>javac StaticMethodDemo.java
D:\java>java StaticMethodDemo
aM IN doIt();
aM IN doIt();
aM IN doIt();
*/
javavishnuvardhanreddy April 17, 2011 at 9:58 PM
super class static method is over writing in the sub class is possible or not?explain...
static methodsachin mishra June 17, 2011 at 3:22 PM
thanks!!! it's very clear and easy defination to learn.
Clear AnswerManoharan July 10, 2011 at 9:24 PM
i dont underStand Static. i want clear ans...
javaAnuradha Kariyawasam February 7, 2013 at 4:39 PM
good
java languageshekhar December 4, 2011 at 5:29 PM
why use static keeyword in java
StaticNagaraju Kaveti March 4, 2012 at 8:08 PM
simple explanation is very will,good thinking. thanks.
static and instance santosh April 30, 2012 at 11:20 AM
what happens when a static method calls a static method with respect to object name if those two static methods are in same class..? what happens when a non-static method calls a static method directly(if those two static and non-static methods are in same class..)..?
StaticMethodBhupesh Sharma June 15, 2012 at 12:46 AM
i don't see any use of these variables : i=100; j=1000; it's just that you have to declare a variable static if you want to use that variable in the static method. it might be confusing if you see the code of this particular Example.
commentsdhananjay singh shrinet July 10, 2012 at 3:16 PM
nicely explained.....
Pls Explin this programme Out put.!!!!!!Satish July 12, 2012 at 4:21 PM
class Csm { public static void doIt() { System.out.println("Am IN doIt();"); } } class StaticMethodDemo { public static void main(String ar[]) { Csm obj1=new Csm(); obj1.doIt(); Csm.doIt(); obj1=null; obj1.doIt(); } } /*OUT PUT: D:\java>javac StaticMethodDemo.java D:\java>java StaticMethodDemo aM IN doIt(); aM IN doIt(); aM IN doIt(); */
Static method and variable...vinay kumar sharma August 22, 2012 at 12:52 PM
static { int x=90; } then what is the type of x variable..is it of type instance variable or class vaiable or any other variable..
thanksmircl September 7, 2012 at 1:23 AM
Thank you :=)
javachinna September 22, 2012 at 11:32 PM
why static variables are not accessed nonstatic
Post your Comment