Can we declare variables inside a method as Final Variables?
Answers were Sorted based on User's Feedback
Answer / therathna
write a small program and check ur system
we can use final variable method
| Is This Answer Correct ? | 15 Yes | 2 No |
Answer / 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 |
What is java volatile?
What is variable declaration and definition?
why we need this (1.object,2.class,3.data hiding,4.encapsulation,5.abstraction,6. polymorphism,7.inheritance)
What are the Object and Class that classes used for?
Why isn’t there operator overloading?
What is lazy initialization in java?
How do you compare two strings? any predefined method for this?
What is string builder in java?
10. What is the output of the following Java program? class Main { public static void main(String args[]){ final int i; i = 10; System.out.println(i); } } 10. What is the output of the following Java program? class Main { public static void main(String args[]){ final int i; i = 10; System.out.println(i); } }
Why do we use variables?
What is a dot notation?
What are the differences between Java 1.0 and Java 2.0?