In my object java class the question is that it is possible to have direct inputs...

90.2K

Verified Solution

Question

Programming

In my object java class the question is that it is possible tohave direct inputs and outputs within the setters and getters, itis highly discouraged to achieve full portability of the code.Explain why.

Answer & Explanation Solved by verified expert
4.1 Ratings (644 Votes)
In the above question it is correctly said that it is possible to have direct Access of input and output values within the setter and getter methods but when it comes to achieve full portability of the code if get highly discouraged to use setter and getter methods This simply means that setter and getter methods in java class fail to achieve full portability of the code First of all lets discuss what actually setter and getter methods are one of the four fundamental concepts in Java is encapsulation which is the mechanism of trapping the data members and methods together as a single unit In this concept the variable of a class will be hidden from other classes and can be accessed only through the methods of their current class Therefore it is also known as data Hiding To achieve encapsulation in Java We can    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students