Question
Consider the following Java code snippet public class Car { private String model; private int year; public Car(String model, int year) { this.model = model; this.year = year; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public int getYear() { return year; } public void setYear(int year) { if (year > 1900 && year <= 2025) { // Basic validation this.year = year; } else { System.out.println("Invalid year."); } } } In this `Car` class, the `model` and `year` fields are declared as `private`. This practice, combined with providing public `get` and `set` methods to access and modify these fields, is a core principle of Object-Oriented Programming known as _______________. It helps in bundling data (fields) and methods that operate on the data within a single unit, and restricting direct access to some of the object's components.
More IT DBMS Questions
- What is the output of the following pseudo-code? ``` count = 0 for i from 1 to 3: for j from 1 to i: count = count + 1 ...
- In the wait-die deadlock prevention scheme, transaction T1 has timestamp 5 and T2 has timestamp 10. If T2 requests a lock on a data item currently held by ...
- What does the 'principle of least privilege' mean in information security?
- Which of the following is an example of a NoSQL database?
- Shadow paging in recovery eliminates the need for:
- In a relational schema, which normal form eliminates transitive dependencies (i.e., non-prime attribute depends on another non-prime attribute)?
- Given Employee(EmpID, Name, DeptID) and Department(DeptID, DeptName), which relational algebra expression correctly retrieves the names of employees workin...
- Given the `SinglyLinkedList` and its `delete_node` method as provided, what will be the output of `my_list.print_list()` after the following sequence of op...
- R(A,B,C) is decomposed into R1(A,B) and R2(B,C). Which condition is sufficient in the standard binary lossless-join test?
- The 'thrashing' in an operating system is related to:
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)