The component of the database that prevents both students from getting the last seat is: transaction isolation
Data that enters the database are expected to maintain accuracy and also be consistent with the database structure.
So, when both students request for the last seat, the possibilities are:
- <em>Student A gets the seat</em>
- <em>Student B gets the seat</em>
The following is not a possibility
- <em>Both students get the seat</em>
- <em>None of the students gets the seat</em>
The above highlights means that, only one of the students would get the seat.
This is possible because of the concept called transaction isolation.
The transaction isolation ensures that the data requested by a user is <em>complete </em>and such data maintains <em>competency</em>.
So, when a student gets the last seat, the <em>next student </em>would not get the same seat (<em>or any other seat</em>), because a transaction has already been completed.
Read more about transaction isolation at:
brainly.com/question/13030145
Answer:
Following are the code to this question:
Counter T = new Counter(1, 100); //creating Counter class object and call its parameterized constructor
Thread T1 = new Thread(new Runnable() //creating Thread object T1.
{
public void run() //define run method
{
T.countRange(); //call countRange method
}
});
Thread T2 = new Thread(new Runnable() //creating another object "T2" of Thread.
{
public void run() //define run method
{
T.countRange(); //call countRange method
}
});
T1.start(); //start Thread T1
T2.start(); //start Thread T2
Explanation:
Description of the above code as follows:
- In the given code, inside the main method the Counter class object "T" is created, that calls its parameterized constructor, which accepts two integer value that is "1 and 100".
- In the next step, thread class object T1 and T2, is created, which uses run method, in which it called the countRange method inside the method a for loop is declared that prints value between parameter value.
- In the last step, the start method is called, which uses the run method to call countRange method.
- For full program code please find the attachment.
yessir i like 2 better cause the plot is better