what is different between static and non static methods ,using
example

Answers were Sorted based on User's Feedback



what is different between static and non static methods ,using example..

Answer / siva

we should create object form calling Non static method but
no necessary to create object for calling static method
using class name we call static method

Is This Answer Correct ?    0 Yes 0 No

what is different between static and non static methods ,using example..

Answer / guest

Static:
we dont have to create instance of an object

Staic methods cannot access nonstatic methods.
same with variable static variables cannot access static
variables

Non-Static:
we have to create instance of an object
nonStaic methos canaccess nonstatic methods.
same with variable nonstatic variables can access static
variables

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Core Java Interview Questions

What is the use of beaninfo?

0 Answers  


class A { public void disp(int a,int b) { System.out.println("hai"); } } class B { public void disp(int a,int b,int c) { System.out.println("hai"); } } above program is overloading or overriding?

9 Answers   Infosys, Wipro,


What is an example of a constant variable?

0 Answers  


Can we have try block without catch block?

0 Answers  


Why do we use variables?

0 Answers  






What is the difference between path and classpath variables?

0 Answers  


what are literals in java?

2 Answers  


What is JVM and is it platform independent?

0 Answers  


Garbage collection in java?

0 Answers  


What do you understand by overloading and overriding in java?

0 Answers  


Is null a string?

0 Answers  


give an example for encapsulation?

0 Answers   Aspire,


Categories