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
- Consider the schedule S: r1(A), r2(A), w1(A), w2(A) of transactions T1 and T2. Which statement about S is correct?
- In database normalization theory, which anomaly specifically refers to the unintended loss of information when a record is removed, because that record hap...
- Which of the following correctly describes a 'primary key' in a relational database?
- In a relational database, what is a candidate key?
- Which normal form eliminates transitive dependency?
- Shadow paging in recovery eliminates the need for:
- What is 'query optimization' in DBMS?
- 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 ...
- Given a table Employees(EmpID, ManagerID, Salary), which SQL statement correctly returns the EmpID of every employee who earns strictly more than their dir...
- A table contains 8,000,000 records, and a B+ tree index built on it has a fan-out (branching order) of exactly 200 at each internal node. What is the appro...
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)