Question
Consider the following Java code: public class Product { private String name; private double price; public Product(String name, double price) { this.name = name; this.price = price; } public String getName() { return name; } public void setPrice(double newPrice) { if (newPrice > 0) { this.price = newPrice; } else { System.out.println("Price cannot be negative."); } } } This code demonstrates encapsulation by:
More IT Operating System Questions
- What is the typical time complexity for inserting an element into a java.util.PriorityQueue with N elements? import java.util.PriorityQueue; ...
- Which of the following real-world applications commonly uses a queue data structure to manage its operations?
- Which of the following is the last part of ICMP message format?
- Is every view serializable schedule also conflict serializable?
- In n-gram models, what does 'n' represent?
- Which AI technique is used for uncertain reasoning?
- Consider the following Python code: def mystery(a, b): if a == 0: return b else: return mystery(b % a, a...
- Address is which type of attribute?
- A Process Control Block (PCB) stores all information about a process. Which of the following is not typically stored in a PCB?
- A memory management system uses fixed (static) partitioning. A process requiring 27 KB of memory is loaded into a partition of size 35 KB, since no smaller...
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)