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

What are the drawbacks of reflection?

565


How do you create a first line indent?

509


What is final access modifier in java?

594


Explain the difference between collection api and stream api in java8?

511


How can I debug the Java security exceptions and AccessControlExceptions?

640






How many inner classes can a class have?

582


Can a static block throw exception?

660


What are strings in physics?

547


What does math floor () do?

559


What is a default method?

523


What are inbuilt functions in java?

563


What is the same as procedures?

538


Why a dead thread occurs?

578


What is meant by oops concept in java?

508


What is a null class?

574