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 the flag in java?
Is linked list a linear or non-linear data structure?
Is it possible to write a regular expression to check if string is a number?
What is e in java?
what is mutual exclusion? : Java thread
What is the use of generics? When was it added to the Java development Kit?
What is the difference between preemptive scheduling and time slicing in java programming?
What is the difference between public, private, protected, and friend access?
Can substring create new object?
How do you convert an int to a double in java?
What is the formula to calculate percentage?
What is meant by method overriding?
What is the difference between scrollbar and scrollpane?
How is string stored in java?
What do you understand by weak reference?