Hello Everyone, I have completed my java certification and I am preparing myself for my upcoming interviews. I am finding the code examples to demonstrate the use of final, finally, and finalize. I have written some code which I mention below. Can anyone check it or suggest me is it right? I am preparing myself for an upcoming java interview and also looking to trending java questions. I am preparing 100 questions list from here and looking to more because I don't wanna lose any opportunity.

Final:

class FinalVarExample {
public static void main( String args[])
{
final int a=10;
a=50; /* Will result in an error as the value canít be changed now*/
}


Finally:

lass FinallyExample {
public static void main(String args[]){
try {
int x=100;
}
catch(Exception e) {
System.out.println(e);
}
finally {
System.out.println("finally block is executing");}
}
}
}

Finalize:

class FinalizeExample {
public void finalize() {
System.out.println("Finalize is called");
}
public static void main(String args[])
{
FinalizeExample f1=new FinalizeExample();
FinalizeExample f2=new FinalizeExample();
f1= NULL;
f2=NULL;
System.gc();
}
}