Can we declare variables inside a method as Final Variables?

Answers were Sorted based on User's Feedback



Can we declare variables inside a method as Final Variables?..

Answer / therathna

write a small program and check ur system

we can use final variable method

Is This Answer Correct ?    15 Yes 2 No

Can we declare variables inside a method as Final Variables?..

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

Can we declare variables inside a method as Final Variables?..

Answer / ravikiran(aptech mumbai)

yes we can declare.

Is This Answer Correct ?    12 Yes 1 No

Post New Answer

More Core Java Interview Questions

define the terminology association.

0 Answers  


Can you give few examples of final classes defined in java api?

0 Answers  


How can I become a good programmer?

0 Answers  


System.out.println("somestring"); It will create any object or not

5 Answers   CSC,


i need source code for income tax program using java inheritance

1 Answers  






What are class types in java?

0 Answers  


What access modifiers can be used for methods?

0 Answers  


how come we know the object is no more used in the class?

2 Answers   Accenture,


What is array length in java?

0 Answers  


What is scope & storage allocation of static, local and register variables? Explain with an example.

0 Answers   IBS,


hr interview how many minutes asking question

0 Answers  


what is diffrence between .NET and java?

2 Answers  


Categories