Explain the keywords - native, transient, volatile, finally

Showing Answers 1 - 12 of 12 Answers

Pankaj Dwivedi

  • Jun 16th, 2005
 

A transient variable is a variable that may not be serialized.

  Was this answer useful?  Yes

kalai

  • Jul 4th, 2005
 

Final variale cannnot be changed.. 
 
Final method cannot be overriddden.. 
 
Final class cannot be derived.

  Was this answer useful?  Yes

Mahamood Akhtar

  • Jul 10th, 2005
 

A volatile variable keeps associated value, until the execution of a thread. We can use the same variable name with volatile keyword in diffenrent threads of a program.

  Was this answer useful?  Yes

srinivasa Reddy

  • Aug 4th, 2005
 

The Finally block is excuted just prior to gc().We can write some housekeeping operations like file close or connection close etc

  Was this answer useful?  Yes

Sisodiya Pramod

  • Aug 16th, 2005
 

native: to use methods which written in other language. 
 
transient:if u declare state of class as trasient then it's not saved in persistent area.  
 
volatile: this is not optimized at the time of optimization because it's value may be changed implicitly or explicitly. 
 
finally: finally is used to do work prior of closing the program because of exception. It's always called by compiler either exception genrated or not.

saidulu

  • Sep 1st, 2005
 

tell about serialisation 
 
inform the tools reqd for j2ee projects

  Was this answer useful?  Yes

uday

  • Sep 23rd, 2005
 

Native : when you want to get functionality from particular language like c/c++ native is used

Transient : it is state of which value doesnt persist

volatile : is an indication to the compiler that the value may be changed by the program some where else

finally : is used in conjunction to try catch block

  Was this answer useful?  Yes

saranya chowdary

  • Sep 29th, 2005
 

native:when you want to get functionality from particular language like c/c++ native is used

Transient : it is state of which value doesnt persist

 volatile : is an indication to the compiler that the value may be changed by the program some where else

final: can be used for variable,method and for class. final variables acts as constant. final methods can not be overridden. final class can not have sub class.

  Was this answer useful?  Yes

Siva Prasad Ashwini

  • Oct 17th, 2005
 

native:when you want to get functionality from particular language like c/c++ native is usedTransient : it is state of which value doesnt persist volatile : is an indication to the compiler that the value may be changed by the program some where

Finally:--If u want some statement should execute compulsory then put all in finally block(ex-closing data base connection which is a costly task)If at all an exception occurs finally block executes.

  Was this answer useful?  Yes

Native :- Specifies that the code that should be implemented is writtern in a language other than JAVA
Transient :- Specifies that the associated variable should NOT be serialized
Volatile :- directs the compiler not to use any optimization techiniques to retreive the value of associated variable as it might be very frequently changing
Finally :- is a block of statments that gets executed everytime the try block is completed and/or exception is generated (usually a good place to free resources like file handlers or database connections etc) ; this gets executed even if we have there's an exception or return statement executed [on when we do a System.exit(); it doesn't get executed]

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions