Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FinalExample{
- public static void main(String[] args){
- final int x=100;
- x=200;//Compile Time Error
- }}
- class FinallyExample{
- public static void main(String[] args){
- try{
- int x=300;
- }catch(Exception e){System.out.println(e);}
- finally{System.out.println("finally block is executed");}
- }}
- class FinalizeExample{
- public void finalize(){System.out.println("finalize called");}
- public static void main(String[] args){
- FinalizeExample f1=new FinalizeExample();
- FinalizeExample f2=new FinalizeExample();
- f1=null;
- f2=null;
- System.gc();
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement