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

Explain about the select method with an example?

585


Can we call the run() method instead of start()?

582


Can we override constructors in java?

678


Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example

2132


What is an example of a constant variable?

525






Write an algorithm program in java for the following question.. 1) S is a set of integers.X is an integer obtained by sum of two digits in S. Write logic for whether or not the X is from the S. The time of algorithm should not exceed o(n logn).

1600


What are the 6 boolean operators?

547


If an object is garbage collected, can it become reachable again?

538


How will you calculate the depth of a binary tree if the tree contains 15 nodes?

593


What is jar?

629


What are identifiers in java?

571


Is singleton class thread safe?

531


How long will it take to learn java?

500


What is java Applet?

643


What types of index data structures can you have in java?

610