Answer Posted / khizar khan
1) Make a class fianl like final class A{}
2) Then use the property as private and final
ex:
final class A{
private final int salary;
}
3)Now make a Constructor to initilize the values
ex:
A(int a)
{ this .salary=a;
}
4)Now use the gtter mathod to acces the values
ex:
final class A{
private final int salary ;
A( int a)
{
this.salary=a;
}
public int getSalary()
{
return salary;
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What do you understand by the term wrapper classes?
Difference between final and effectively final ? Why is effectively final even required ?
Describe method overriding
How to sort elements in a parallel array in java?
What is Java Annotations?
How does linkedhashmap work in java?
Why do we need variables?
How objects are stored in java?
If a class is declared without any access modifiers, where can the class be accessed?
Can Exception handling we can handle multiple catch blocks?
What are constants?
Differentiate between overriding and overloading cases?
What is the difference between choice and list?
What is double checked locking in singleton?
What are the skills required for core java?