Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Java Relationship Questions within the Java forums, part of the Software Development category; 1.What is an "is a" relationship? How does it apply to the world of objects? 2. What is a "has a" relationship? 3. Explain how parent and child classes are ...
|
|||||||
|
|||
|
Java Relationship Questions
1.What is an "is a" relationship? How does it apply to the world of objects?
2. What is a "has a" relationship? 3. Explain how parent and child classes are related to base and derived classes. 5. Explain the modifiers public, protected and private. |
| Sponsored Links |
|
|||
|
Re: Java Relationship Questions
hi actaully i want to know that " how to call the garbage collector in java"
instead of using system.gc(). bcz if we use that may be or mayn't the jvm will call the GC, but i want to call the GC manually. plz send me the resplonse |
|
|||
|
Re: Java Relationship Questions
Zemi,
1.what is an "is a" relationship? how does it apply to the world of objects? when a class inherits from another class, the former is a specific form of the latter. Example, if dog inherits from animal, we can say dog is a animal. 2. What is a "has a" relationship? whenever one object has a member varibale that is a reference to another object. It is a has a relationship. For example class dog { tail dogtail; //here tail is another object } now we can say a dog has a tail. 3. Explain how parent and child classes are related to base and derived classes. parent = base class child = derived class. I guess it's just terminology 5. Explain the modifiers public, protected and private. public : all instances of other classes, irrespective of the module, namespace or package can have access to this artifact (class, method, variable) protected : all instances of other classes in the same package and subclasses in other packages can have acces to this (once child class inherits a protected method or variable, it becomes private with respect to child class). This cannot be applied to top level classes in java. Private : only, i repeat, only memebrs of the same class can access this. Nobody from outside, even if from same package can access this. Hope this helps. |
|
|||
|
Re: Java Relationship Questions
For Mohan,
Try not to cross post. Your topic will have more visibilty if it has it's own subject in a separate thread. Anyway, I am not the moderator, so here goes: IMHO, you CANNOT guarantee the garbage collecter will run, no matter what method you use. Two ways to recommend running the garbage collecter are: System.gc() as you already pointed out. Runtime rt = Runtime.getRuntime(); rt.gc(); Both serve the same purpose and do not force garbage collecter to run. |
|
|||
|
Re: Java Relationship Questions
please find the some important questions for Core Java and HR interviews.
|
| The Following User Says Thank You to bhaskar22 For This Useful Post: | ||
|
|||
|
Re: Java Relationship Questions
Quote:
hey mohan actually u can use an alternate method to run gc explicitly. just use following code. "Runtime rt = Runtime.getRuntime(); rt.gc(); " |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java Interview Questions Ebook Download | admin | Downloads | 222 | 5 Days Ago 07:51 AM |
| Relationship in Database | RyanJames | Database General | 1 | 01-12-2008 01:51 PM |
| Java Coding Interview Questions | promodkumardas | Java | 0 | 02-26-2007 09:57 PM |
| solve the relationship | vmshenoy | Brainteasers | 7 | 01-16-2007 01:53 AM |
| Relationship between compilers and executables | blenda | C and C++ | 1 | 11-12-2006 03:06 PM |