UrbanPro

Take BCA Tuition from the Best Tutors

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

Search in

What is the difference between final, finally and finalize?

Asked by Last Modified  

Follow 2
Answer

Please enter your answer

Sr. Software Engineer at Bureau Veritas, former Sr. Software Consultant at Aptech Malviynagar

Final: 1. It is a non access modifier that can be applied to variables,methods and to class. 2. Final means non-changable. Final variable: 1. If a variable is declared as final it can't be re-assigned. 2. If there is any final variable in class simply compiler replaces its original value to that variable...
read more

Final:

1. It is a non access modifier that can be applied to variables,methods and to class.

2. Final means non-changable.

 

Final variable:

1. If a variable is declared as final it can't be re-assigned.

2. If there is any final variable in class simply compiler replaces its original value to that variable at compile time only,hence at runtime direct the constant value participates.

3. Final variable should must be initialized at the declaration time.

4. Final variable doesn't get any default value by compile or jvm,the programmer needs to initialize.

 

Final Method:

1. If we are declaring method as final in class, that method can't be re-defined or override.

2. If parent class want that their child can't re-define the method then parent class can define the final method in their class.

 

Final Class:

1. If we are declaraing class as final, that class can't be inherited.

2. For example-String class is final and we can't extends the String class.

 

Finally:

1. Finally is the keyword that comes along with try.

2. To write the clean-up code we can place the finally block. for example-Database closing logic,Stream closing logic or any other resource closing logic which we have opened.

3. This block must be executed irrespective of the Exception in the code.

 

Finalize:

1. This is the method of Object class and is applicable for all java objects.

2. Before destroying the objects, jvm calls the Garbage Collector and Garbage collector implicitly calls the finalize() method to perform the cleanup activity.

read less
Comments

Related Questions

give me best coaching center in karnal of bca if anyone person who will give me best guideces with studies
you can search by google also. but best will be to touch your senior for best answer.
Rajattyagi

What is an Array?

An array is a collection of (same or different type of) items.In Java and C#, etc., the elements inside the array should be of the same type (e.g. ) while in languages like JavaScript and Python. The elements can be different types also(e.g. )
M
How to learn Java?
you learn self Java by good book. otherwise should be take help by tutors.
Harsh
Which language is best to learn for college freshers ?
Please tell me which class you read then I can suggest you.
Arjun
How to become instructor???
Good teachers know how to bring out the best in their students, but it’s not magic and it’s not just about popularity. Here are some of the “tricks” good teachers use: Encourage high expectations Set...
Jimmy

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

Ask a Question

Related Lessons

TestNG Annotations and its sequence
public class TestNGAnnotations { @BeforeMethod public void beforeM() { System.out.println("Before Method"); } @AfterMethod public void afterMethod() { System.out.println("After Method"); } @BeforeClass...
S

Sarthak C.

0 0
0

Spring - Dependency Injection (DI)
Spring - Dependency Injection (DI) DI is a framework which provides loose coupling in code. Here loose coupling means no hard coding of the object. Instead of hard coding, we will be injecting these object...

Java: A Quick Overview
Not purely Object Oriented: It doesn't support multiple inheritence, it supports primitive data types and static members. Doesn’t support multiple inheritance: Reason is diamond problem i.e.,...


How can everyone prepare to clear any Java interview?
Java interview your java should be much strong then J2EE. core java and Advance java is the basic foundation for Interview. Some of the topic about which you should know before going for a java interview...

Recommended Articles

With the current trend of the world going digital, electronic renaissance is a new movement that is welcomed by the new generation as it helps makes the lives of millions of people easier and convenient. Along with this rapidly changing movement and gaining popularity of Internet, e-Learning is a new tool that emerging...

Read full article >

With the mushrooming of international and private schools, it may seem that the education system of India is healthy. In reality, only 29% of children are sent to the private schools, while the remaining head for government or state funded education. So, to check the reality of Indian education system it is better to look...

Read full article >

E-learning is not just about delivering lessons online. It has a much broader scope that goes beyond manual paper or PowerPoint Presentations. To understand the reach of E-learning and how the whole process works in developing the Educational system, we will discuss a few points here. Let us find out how this new learning...

Read full article >

Quality education does not only help children to get a successful career and life, but it also hugely contributes to society. The formal education of every child starts from school. Although there are numerous schools, parents find it challenging to choose the right one that would fit their child. It is difficult for them...

Read full article >

Looking for BCA Tuition ?

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 BCA Tuition Classes?

The best tutors for BCA Tuition Classes are on UrbanPro

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

Take BCA Tuition with the Best Tutors

The best Tutors for BCA Tuition 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