Java - Object-Oriented Programming Concepts
What will be the output of this Java code?
class Product {
String name;
double price;
void display() {
System.out.println(name + ": $" + price);
}
}
public class Shop {
public static void main(String[] args) {
Product p = new Product();
p.name = "Pen";
p.price = 1.5;
p.display();
}
}