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
Differentiate between class and structure.
Explain what do you mean by functional overloading in java?
What are the uses of synchronized keyword?
How to create com object in Java?
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
What is object-oriented paradigm?
What is keyset in java?
What does nullpointerexception mean?
What is difference between stringbuffer and string?
What is initial size of arraylist in java?
Why do we need array in java?
How will you print number in reverse (descending) order in BST.
What is difference between printf and scanf?
When should you use arraylist and when should you use linkedlist?
What is meant by collection in java?