answer: B
make more secure because of final attribute
C failed
it can be changed without final attribute
D failed
the value can be changed
A failed
make less secure because of public access
The correct answer is D. protected final String beta = "beta"; Making the beta field final would prevent it from being modified after it is initialized, which can make the class more secure by ensuring that the beta field cannot be changed after the object is constructed. Changing the access modifier to protected would restrict access to the beta field to classes in the same package and subclasses, which can also improve security by limiting the code that can access the field.
In the original code it is possible to set the ALPHA-static variable before calling the foo()-method by Foo.ALPHA = "xxxx";
To make it more secure you should make this variable final so that an outside program cannot modify it.
The change that would make the Foo class more secure is option C. private String delta. This would restrict access to the delta variable to only within the Foo class, making it more secure.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ASPushkin
6 months, 3 weeks agod7bb0b2
1 year, 1 month ago[Removed]
1 year, 4 months agoStavok
1 year, 6 months agoAdel2023
1 year, 8 months ago