Skip to content

Instantly share code, notes, and snippets.

@cmoz
cmoz / Main2.java
Created February 22, 2024 21:50
LinkedList example and overriding the toString() method
import java.util.LinkedList;
class ProductItem {
private int productId;
private String productName;
public ProductItem(int productId, String productName) {
this.productId = productId;
this.productName = productName;
}
@cmoz
cmoz / Main.java
Created February 22, 2024 21:52
First example with linkedList and a Product object
import java.util.LinkedList;
// our product class that we created to create a product
class Product {
private String name;
private double price;
private String description;
// Getters and setters for product properties