UrbanPro

Learn Java Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

class HappyGarbage01 { public static void main(String args[]) { HappyGarbage01 h = new HappyGarbage01(); h.methodA(); /* Line 6 */ } Object methodA() { Object obj1 = new Object(); Object [] obj2 = new Object[1]; obj2[0] = obj1; obj1 = null; return obj2[0]; } } Where will be the most chance of the garbage collector being invoked? A. After line 9 B. After line 10 C. After line 11 D. Garbage collector never invoked in methodA()

Asked by Last Modified  

14 Answers

Learn Java

Follow 0
Answer

Please enter your answer

Trainer

Hello Shrikant who told you that you can explicity call garbage collector. You cann't call gc explicity even when you use System.gc() it is not guranteed that gc will be invoked it is all up to JVM when an object is eligible for garbage collection.even when you use finalise method that is a protected...
read more
Hello Shrikant who told you that you can explicity call garbage collector. You cann't call gc explicity even when you use System.gc() it is not guranteed that gc will be invoked it is all up to JVM when an object is eligible for garbage collection.even when you use finalise method that is a protected method of java.lang.Object class read less
Comments

D
Comments

Master

D. Garbage collector never invoked in methodA()
Comments

Core Java, Angular 2/4/6, J2EE, Spring Boot

Answer is C ... because object 1 is referred to null. So it will be eleigible for GC.
Comments

Experience in Java and Android Trainer.

Garbage collector never invoked in methodA()
Comments

JAVA,JDBC,SERVLETS,JSP,STRUTS,SPRNG,HIBERNATE

After line 11
Comments

After line 11 (because memory location allocated to obj1 will be freed as part of line 12 . so obj1 is eligible for garbage collection)
Comments

Java/J2EE, B.E./B.Tech/MCA SubjectsTraining

D
Comments

Java Techonologies

It takes place after line 6, but there is no possibility to check when garbage collector is called/invoked since it JVM dependent.
Comments

IT Professional Trainer with 15 years of experience in IT Industry

D
Comments

View 12 more Answers

Related Questions

Should I learn a Python course online or offline? What are some good Python training classes?
If it is that much simple as i have been said to learn from the internet then everyone would have been developer according to me you should learn offline by some good institute. like Praxware technologies...
Neha
0 0
8
What are the advantages of learning Java?
Dear Niteen Java is one of the most widest implemented technology for programming. Not only its used to develop full fledged Software Applications, but its also used for programming devices like Set...
Niteen
0 0
6

I am a fresher and I want to become a Java developer, so what is necessary to crack the Java interview ? 

For an interview, you should prepare all the basic questions of Java , class, function and OOP concepts.
Dipesh

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Software Testing
Software testing is a process of executing a program or application with the intent of finding the software bugs. It can also be stated as the process of validating and verifying that a software program...

Software Development Training In Jaipur
Satyam Web Solution provides website designing &development and software designing &development training in Jaipur for various stream’s students. MCA 6 month Industrial Training/Internship B....

Crux Of The Basic Interview Question Asked Around It Professionals
Question: Explain PSVM() in Java. Answer: This question is asked from a differnet persctive. Person asking this question is looking for deep java concepts. If answer in your mind is something like...

What Is Applet & Its Life Cycle?
What is Applet & its life cycle?Applet is a Java programme that can be embedded into HTML page.Java Applet runs on the java enables web browsers such as Mozilla & Internet Explorer.Applets are...
I

ICreative Solution

0 0
0

COMPILATION AND INTERPRETATION
Compilation and Interpertation Process javac (compiler) java(interpreter)high level code - > compile - > bytecode - > interperted - > machine code Bytecode...

Recommended Articles

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”.  Right from its first implication as java 1.0...

Read full article >

Designed in a flexible and user-friendly demeanor, Java is the most commonly used programming language for the creation of web applications and platform. It allows developers to “write once, run anywhere” (WORA). It is general-purpose, a high-level programming language developed by Sun Microsystem. Initially known as an...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Training with the Best Tutors

The best Tutors for Java Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more