Is there a destructor in Java

0 votes
Can we use destructor in Java?
May 9, 2018 in Java by Daisy
• 8,120 points
761 views

2 answers to this question.

0 votes
Java has internal garbage collector. So, you can not predict when the object will be destroyed. Hence no need of destructor.
answered May 9, 2018 by Parth
• 4,630 points
0 votes
try (BufferedReader br = new BufferedReader(new FileReader(path))) {
  System.out.println(br.readLine());
} catch (Exception e) {
  ...
} finally {
  ...
}
answered Sep 4, 2018 by Sushmita
• 6,910 points

Related Questions In Java

0 votes
2 answers

Is there a SortedList in Java?

Since all lists are already "sorted" by ...READ MORE

answered Nov 2, 2018 in Java by Sushmita
• 6,910 points
4,170 views
0 votes
3 answers

Check if a String is numeric in Java

Java 8 Lambda Expression is used: String someString ...READ MORE

answered Sep 3, 2018 in Java by Daisy
• 8,120 points
3,383 views
0 votes
3 answers

Is there any goto statement in java?

So they could be used one day ...READ MORE

answered Oct 15, 2018 in Java by Daisy
• 8,120 points
932 views
0 votes
1 answer

What is the simplest way to read JSON from a URL in java

Read json from url use url.openStream() and read contents ...READ MORE

answered Jun 13, 2018 in Java by samarth295
• 2,220 points
4,836 views
0 votes
2 answers

Copying Objects in Java

class DummyBean { private String dummy; ...READ MORE

answered Aug 6, 2018 in Java by Sushmita
• 6,910 points
506 views
0 votes
2 answers

Array of Objects

You can also do : A[] a = ...READ MORE

answered Aug 3, 2018 in Java by sharth
• 3,370 points
523 views
+1 vote
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

answered May 10, 2018 in Java by Rishabh
• 3,620 points
1,035 views
0 votes
1 answer

What is the 'instanceof' operator used for in Java?

It's an operator that returns true if ...READ MORE

answered May 23, 2018 in Java by Rishabh
• 3,620 points
822 views
0 votes
3 answers

How to read a Text File in Java?

You can use readAllLines and the join method to ...READ MORE

answered Jul 28, 2018 in Java by samarth295
• 2,220 points
2,138 views
0 votes
2 answers

How to read a text file in Java?

You can use Scanner class to read ...READ MORE

answered Aug 9, 2018 in Java by Parth
• 4,630 points
779 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP