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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How can constructor chaining be done using this keyword?

919


Is multiple inheritance supported by java?

686


What is jar?

826


What is meant by 'bit masking' in java?

859


Can we sort set in java?

738


What are the fileinputstream and fileoutputstream?

819


How strings are created in java?

791


What is the difference between actual and formal parameters?

694


What is meant by javabeans?

810


List some java keywords sun like c, c + + keywords?

781


What is the maximum size of byte array in java?

748


Can anonymous class have constructor?

753


What will be the initial value of an object reference which is defined as an instance variable?

880


Write an algorithm program in java for the following question.. In a VLSI design techniques,they used rectangles to design circuits. EVery rectangle is to be placed according to x,y coordinates. Check whether or not two rectangles overlap each other. Here overlapping of rectangles is acceptable, if 1) one rectangle intersect with other. 2) one rectangle fully covers other. The time of algorithm should not exceed o(n logn).

2428


What is difference between java and java ee?

752