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 is an iterator interface in java programming?
What is the synchronized method modifier?
Is java programming easy?
How objects are stored in java?
When is finally block not called?
How can a gui component handle its own events?
What is derived datatype?
What does void * mean?
Write a program to reverse array in place?
Are strings immutable in java?
What does escaping a character mean?
Is a char always 1 byte?
How do you sort arrays in java?
Can we increase size of array?
What is the similarity between dynamic binding and linking?