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

How to display arraylist values in java?

0 Answers  


What are the two types of java?

0 Answers  


What do you mean by an interface in java?

0 Answers  


what is deadlock? : Java thread

0 Answers  


What does system.gc() and runtime.gc() methods do?

0 Answers  


When do you get classcastexception?

0 Answers  


what is difference between class and object?

43 Answers   College School Exams Tests, HCL,


What is the difference between yield() and sleep()?

0 Answers  


How many types of methods are there?

0 Answers  


How many types of classes are there in java?

0 Answers  


What code optimizations techniques you follow in general practice?

2 Answers   Accenture, TCS, Wipro,


Can we override the overloaded method?

0 Answers  


Categories