Can we declare variables inside a method as Final Variables?

Answer Posted / srinu

yes we can declare a varible as final variable inside method
public class Finalv
{
public void m1()
{
final int a=10;
System.out.println(a);
}
public static void main(String k[])
{
Finalv f=new Finalv();
f.m1();
}
}

Is This Answer Correct ?    13 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you know if a value is nan?

548


What is byte data type?

528


Are floats faster than doubles?

542


How can you avoid serialization in child class if the base class is implementing the serializable interface?

603


Which is better ascii or unicode?

538






When does a class need a virtual destructor?

510


What do the thread?class methods run() and start() do?

515


How do you sort an array in java?

513


What is difference between throw and throws ?

574


How do you use wildcards?

508


What is an infinite loop in java? Explain with an example.

556


Why static functions are used?

547


What happens if an exception is not handled in a program?

599


How to create an immutable class?

548


Where we write javascript code in html page?

539