Which changes made to the following class would help to properly encapsulate the data in the class?
Question:
Which changes made to the following class would help to properly encapsulate the data in the class?
A. Add a getter method for material.
B. Add a setter method for material.
C. Change the access modifier of material to protected.
D. Change the access modifier of strength to private.
E. None of the above.
Transcribed Image Text:
package shield; public class Protect { private String material; protected int strength; } public int getStrength () { return strength; } public void setStrength (int strength) { this.strength = strength; }
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 80% (5 reviews)
Encapsulation in objectoriented programming is the bundling of data with the methods that operate on that data or the restriction of direct access to ...View the full answer
Answered By
Aysha Ali
my name is ayesha ali. i have done my matriculation in science topics with a+ . then i got admission in the field of computer science and technology in punjab college, lahore. i have passed my final examination of college with a+ also. after that, i got admission in the biggest university of pakistan which is university of the punjab. i am studying business and information technology in my university. i always stand first in my class. i am very brilliant client. my experts always appreciate my work. my projects are very popular in my university because i always complete my work with extreme devotion. i have a great knowledge about all major science topics. science topics always remain my favorite topics. i am also a home expert. i teach many clients at my home ranging from pre-school level to university level. my clients always show excellent result. i am expert in writing essays, reports, speeches, researches and all type of projects. i also have a vast knowledge about business, marketing, cost accounting and finance. i am also expert in making presentations on powerpoint and microsoft word. if you need any sort of help in any topic, please dont hesitate to consult with me. i will provide you the best work at a very reasonable price. i am quality oriented and i have 5 year experience in the following field.
matriculation in science topics; inter in computer science; bachelors in business and information technology
_embed src=http://www.clocklink.com/clocks/0018-orange.swf?timezone=usa_albany& width=200 height=200 wmode=transparent type=application/x-shockwave-flash_
4.40+
11+ Reviews
14+ Question Solved
Related Book For
OCP Oracle Certified Professional Java SE 11 Developer Practice Tests Exam 1Z0 819 And Upgrade Exam 1Z0 817
ISBN: 9781119696131
1st Edition
Authors: Scott Selikoff, Jeanne Boyarsky
Question Posted:
Students also viewed these Computer science questions
-
Explain why Durkheim favored quantitative methods in his study of suicide, and summarize the reasons by using keywords such as a) natural science; b) objective; and 3) positivism.
-
A client invested $100 in a mutual fund at the start of the month. After 20 days, the portfolio gained 10% (i.e., value = $110), and the client added an extra $50 (total portfolio value=$160). From...
-
Imagine you are presenting a business plan to potential funders of your business idea. Develop your business plan with the following headings: a. Executive summary b. Company/business description c....
-
What problems are associated with tracking historical costs?
-
Calculate the amount of work input a refrigerator needs to make ice cubes out of a tray of 0.5 lbm liquid water at 50 F. Assume the refrigerator has = 3.5 and a motor-compressor of 750 W. How much...
-
Design a problem that would require insight for its solution.
-
Panera Bread was on Fortune magazine's 2010 list of 100 Fastest-Growing Companies, was awarded #1 ranking for Best Salads and Top Rated Facilities (for chain restaurants with less than 5,000 outlets)...
-
The comparative balance sheets of Susan Saboda Design Studio, Inc., at June 30, 2012 and 2011, and transaction data for fiscal 2012, are as follows: Transaction data for the year ended June 30, 2012,...
-
The cash budget was prepared with the following assumptions: The Company has borrowed a $500,000 revolving loan on 31 December last year, charging 1% interest per month. Borrowing should be made to...
-
What is output by the following? A. 3 10 B. 3 12 C. 5 10 D. 5 12 E. The code does not compile. F. None of the above. 10: int m = 0, n = 0; 11: while (m < 5) { 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:...
-
Given that Integer and Long are direct subclasses of Number, what type can be used to fill in the blank in the following class to allow it to compile? A. Long B. Integer C. Long or Integer D. Long or...
-
You have just purchased a house and have obtained a 30- year, $ 200,000 mortgage with an interest rate of 10 percent. Required: a. What is your annual payment? b. Assuming you bought the house on...
-
How could civil engineers contribute to space debris management and cleanup?
-
In what ways can the principles of resilient infrastructure be applied to design urban systems capable of withstanding natural disasters, and how do these principles contribute to the overall safety...
-
What are local variables and global variables in Python?
-
When to use a tuple vs list vs dictionary in Python? Explain some benefits of Python
-
What is Lambda Functions in Python? How do I modify a string in python?
-
J. T. Payne executed a valid will on June 29, 1934. On April 24, 1956, a will with singed edges was offered to the probate court. Three of his children challenged the will, contending the deceased...
-
Find the reduced echelon form of each of the matrices given in Problems 120. c 1 26 + 4
-
In Figure 9.9, why is the destination hardware address all 0s in the ARP request message? Figure 9.9 System A System B N2 N1 L1 L2 (Not known by A) Ox0001 Ox04 Ox0800 06 Ox0001 ARP request L1 N1 All...
-
In the previous problem, assume Alice cannot find a direct flight from the Los Angeles to the Chicago. If she needs to change flights in Denver, a. Find the end-to-end addresses in this scenario. b....
-
In Figure 9.9, why is the destination hardware address of the frame from A to B a broadcast address? Figure 9.9 System A System B N2 N1 L1 L2 (Not known by A) Ox0001 Ox04 Ox0800 06 Ox0001 ARP request...
-
The following is part of the computer output from a regression of monthly returns on Waterworks stock against the S&P 5 0 0 index. A hedge fund manager believes that Waterworks is underpriced, with...
-
Doisneau 25-year bonds have an annual coupon interest of 8 percent, make interest payments on a semiannual basis, and have a $1,000 par value. If the bonds are trading with a market's required yield...
-
Hite corporation intends to issue $160,000 of 5% convertible bonds with a conversion price of $40 per share. The company has 40,000 shares of common stock outstanding and expects to earn $600,000...
Study smarter with the SolutionInn App