Is there a destructor in Java

0 votes
Can we use destructor in Java?
May 9, 2018 in Java by Daisy
• 8,140 points
965 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,640 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,920 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,920 points
4,540 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,140 points
3,758 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,140 points
1,346 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
5,212 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,920 points
820 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
874 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,361 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
1,123 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,556 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,640 points
1,178 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