Question : | Explain garbage collection ? | ||||
Answer : | Garbage collection is an important part of Java's security strategy. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects from the memory. The name "garbage collection" implies that objects that are no longer needed by the program are "garbage" and can be thrown away. A more accurate and up-to-date metaphor might be "memory recycling." When an object is no longer referenced by the program, the heap space it occupies must be recycled so that the space is available for subsequent new objects. The garbage collector must somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects. In the process of freeing unreferenced objects, the garbage collector must run any finalizers of objects being freed.
| ||||
Question : | How you can force the garbage collection ? | ||||
Answer : | Garbage collection automatic process and can't be forced. We can call garbage collector in Java by calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected. | ||||
Question : | What are the field/method access levels (specifiers) and class access levels ? | ||||
Answer : | Each field and method has an access level:
| ||||
Question : | What are the static fields & static Methods ? | ||||
Answer : | If a field or method defined as a static, there is only one copy for entire class, rather than one copy for each instance of class. static method cannot accecss non-static field or call non-static method Example Java Code static int counter = 0; A public static field or method can be accessed from outside the class using either the usual notation: Java-class-object.field-or-method-name or using the class name instead of the name of the class object: Java- class-name.field-or-method-name | ||||
Question : | What are the Final fields & Final Methods ? | ||||
Answer : | Fields and methods can also be declared final. A final method cannot be overridden in a subclass. A final field is like a constant: once it has been given a value, it cannot be assigned to again. Java Code private static final int MAXATTEMPTS = 10; |
Monday, April 14, 2008
JAVA INTERVIEW QUESTIONS (2)
Subscribe to:
Post Comments (Atom)
Archives
-
▼
2008
(201)
-
▼
April
(137)
- Q & A on Teoretical ANalysis of Router Systems
- Q & A on Application Level Gateways,
- Q & A on Ethernet Transceivers and "10BaseT",
- Q & A on 100BaseT and 10BaseT Cabling,
- Q & A on One LAN or Many LANs on a Campus,
- Q & A on ICMP and UDP "ping",
- Q & A on Netweork Analyzer Software,
- Q & A on Writing a Network Analyzer,
- Q & A on Interpreting IP Addresses in Octal,
- Q & A on New Top-Level Domains for DNS,
- Q & A on WAP and TCP.
- Q & A on TCP Segment Lengths.
- Q & A on TCP/IP Between Hosts on a Single Network.
- Q & A on "Internetworking with TCP/IP, Volume 1".
- Q & A on TPC/IP Layering Model,
- Q & A on IP Address Prefixes and Suffixes
- Q & A on "Net 0" IP Addresses.
- Q & A on Network Standard Byte Order and User Data.
- Q & A on Network Topologies,
- Q & A on Code for Internetworking with TCP/IP, Vol...
- Q & A on Attenuation in Ethernet Network Design
- Q & A on Hardware Technologies
- Computer Network Questions and Answers Part 1
- Computer Network Questions and Answers Part 2.
- Computer Network Questions and Answers Part 3.
- Computer Network Questions and Answers Part 4.
- Computer Network Questions and Answers Part 5,
- Computer Network Questions and Answers Part 6.
- Computer Network Questions and Answers Part 7.
- Computer Network Questions and Answers Part 8.
- Computer Network Questions and Answers Part 9,
- networking 146
- Basic Networkin Questions - 2, 142
- Basic Networkin Questions - 1 140
- Networking, Socket Programming, Inter-Process Comm...
- Networking Interview questions 134
- Networking Interview questions 130
- Computer Networking Interview Questions 128
- Networking Interview Questions 126
- JAVA QUESTIONS 125
- JAVA INTERVIEW QUESTIONS 120
- Core Java Test Paper1 116
- Java Interview Questions And Answers 112
- Java Interview Questions And Answers 108
- Advanced enterprise Java interview questions 106
- Advanced JAVA questions 104
- (FAQ) Advanced Java Interview Questions 100
- TrainJava Blog interviews 98
- Java Exceptions Questions 94
- Java technical interview guide - part 1 90
- Advanced Java Interview Questions And Answers 88
- Java J2EE Interview Questions and Answers 84
- Java Architect Interview Questions 82
- Advanced enterprise Java Interview Questions 80
- java script interview questions 78
- importent java interviews and answers
- importent study interview questions in java 74
- java total interview questions 68
- java interviews 66
- importent java interview questions 64
- java importent studying questions
- core java importent interviews 62
- corejava 60
- interviews of corejava 58
- corejava interviews 54
- core java more interviews 52
- core java inerviews 51
- core java interview questions 50
- corejava 50
- Core Java Interview Questions and Answers 48
- Core Java Interview Questions and Answers 46
- 300 Core java interview questions And Answer 44
- Java Interview Questions and Answers 40
- Java Interview Questions and Answers 34
- Java Interview Questions and Answers 32
- Java Interview Questions and Answers 30
- Java Interview Questions and Answers 28
- java interview questions 26
- java importent interview questions 24
- Java and Perl Web programming interview questions 23
- java interview questions 22
- Basic Java interview question 16
- Some Java Job Interview Questions 15
- Java Technical Questions with Answers 14
- Table of Contents:
- Visual Basic Interview Questions 13
- Java Interview Questions... 12
- Advanced enterprise Java Interview Questions
- Advanced Java Programming Interview Questions 10
- java questions 9
- Advanced Java Interview Questions 8
- Java interview questions 7
- JAVA INTERVIEW QUESTIONS (5)
- JAVA INTERVIEW QUESTIONS (4)
- JAVA INTERVIEW QUESTIONS (3)
- JAVA INTERVIEW QUESTIONS (2)
- JAVA INTERVIEW QUESTIONS 1
- Core Java Interview Questions books
- core java importent questions
- 30 simple Java questions
-
▼
April
(137)
No comments:
Post a Comment