1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aleksklad [387]
3 years ago
7

Define a public class named Sample with two instance variables: an int called count and a String called name. Provide a complete

constructor that allows both fields to be initialized when instances of Sample are created with count as its first parameter and name as its second. Neither count nor name should be public. Rather, you should provide: Both a getter and a setter for count Only a getter for name: this is how you can create a read-only variable in Java. Your getters and setters should follow the naming convention we have been using in class: get or set followed by the name of the field, capitalized. Getters should have the same return type as the variable that they are returning. Setters should not return a value.
Computers and Technology
1 answer:
Firlakuza [10]3 years ago
7 0

Answer:

The code to this question can be given as:

class Sample  //define class Sample.

{  

   //define private member.

 private int count;            

 private String name;

 Sample(int count, String name)           //define parameterized constructor.  

 {

   this.count = count;               //holding values.

   this.name = name;

 }

 public int getCount()                   //define function with returntype.

 {

   return count;

 }

 public String getName()         //define function with returntype.

 {

   return name;

 }

 public void setCount(int count)       //define function with no returntype.

 {

   this.count = count;

 }

public void setName(String name)         //define function with no returntype.

 {

   this.name = name;

 }

}

Explanation:

In the above code firstly we define the class that is Sample. In this class, we define two variable that is not public. Then we define the constructor. This code we parameterized constructor because it takes the values as a parameter. To assign the value in the constructor we use this keyword.  Then we used the get and set method. when we use get method because it returns a value (getcount and getname).  When we use the set method it does not return any value (setcount and setname).

You might be interested in
Which of the following is a benefit, as well as a risk, associated with peer-to-peer networks?
Anna71 [15]
<span>Clients depend on a working main server to perform their jobs: no, p2p relies on a structure without a central server. 

</span><span>Individuals can easily add or remove devices from their network: yes, this is true.

</span><span>Requires an IT professional, but easy to add clients to server and give privileges: no, in p2p, the server doesn't play a role.
</span>
<span>Software is maintained on the server, allowing for easy access to upgrade programs for all users: this is not an aspect of p2p</span>
5 0
4 years ago
Read 2 more answers
You use buttons and commands on the ribbon to tell word what you want to do. true or false
GarryVolchara [31]
Yes, that is true. The buttons and commands are used for their specific actions on the computer.
7 0
4 years ago
Clarifying and developing our personal values involves a number of steps including critical thinking
Grace [21]
True. I think we should trust ourselves and interaction with someone including teachers, classmates and parents...We must be developing our critical thinking skills.
8 0
3 years ago
3.The contains the computer's "brain," the central processing unit (CPU).
Leto [7]
The computer brain is a microprocessor<span> called the central processing unit (CPU). The CPU is a chip containing millions of tiny transistors. It's the CPU's job to perform the calculations necessary to make the computer work -- the transistors in the CPU manipulate the data. You can think of a CPU as the decision maker.</span>
6 0
4 years ago
Read 2 more answers
using the concept of defense in depth, which layers might we utilize to implement defenses to secure ourselves against someone r
quester [9]

Environmental protections would need to be in place which would ensure USB threats were non-issue by using the concept of defense in depth. Provide them with work USB sticks that have automatic encryption protection instead of expecting them to find or utilise ones that have been supplied to them by others. One technique to ensure that there won't be a data breach if a USB stick is lost is to use encrypted devices.

A method known as "defence in depth" uses a variety of security measures to safeguard an organization's assets. The idea is that extra layers exist as a backup to ensure that threats are stopped along the road if one line of protection is breached.

In order to safeguard the confidentiality, integrity, and availability of a computer network and the data contained inside it, a number of security methods and controls are deliberately stacked throughout the network. This strategy is known as defence in depth (DiD).

Depending on the point of concentration, defence in depth can be divided into three control layers. These include administrative, technical, and physical controls.

Learn more about defense in depth:

brainly.com/question/13566507

#SPJ4

7 0
1 year ago
Other questions:
  • Match each of the following terms to its function:_________
    13·1 answer
  • Select the correct answer. Andy wants to become a multimedia producer. Which degree can help him achieve this goal? A. bachelor’
    5·1 answer
  • PLEASE HELP!!!! I'll mark Brainliest for whoever is first!!!!
    13·2 answers
  • Write a function to output an array of ints on a single line. Funtion Should take an array and an array length and return a void
    9·1 answer
  • A measuring cylinder is used to measure the volume of an irregular<br>solid object.​
    5·1 answer
  • What is the name of the worm that was written in 1988 that could replicate itself across computers on the internet?
    7·1 answer
  • Give an example of a class and an example of an object. Describe what a class is, what an object is, and how they are related. U
    6·1 answer
  • You are evaluating three branch prediction strategies: (1) predict always taken, (2) predict always not taken and (3) use the 2-
    14·1 answer
  • How to call a void method with no parameters IN JAVA?
    8·1 answer
  • Which type of wireless attack is designed to capture wireless transmissions coming from legitimate users
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!