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
What is the difference between synchronized and synchronized block?
What are the legal parameters?
Can subclass overriding method declare an exception if parent class method doesn't throw an exception?
What is the java reflection api? Why it’s so important to have?
What is default size of arraylist in java?
What does the exclamation mark mean in java?
What is classes in java?
What are the differences between include directive and include action?
what do you mean by classloader in java?
is it possible to instantiate the math class?
Is java a virus?
How do I remove a character from a string in java?
How do you avoid global variables?
Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?
What is lazy initialization in java?