需要一个完整代码,谢谢((˵¯͒〰¯͒˵)(=TェT=)挨骂˃ʍ˂)
2条回答 默认 最新
- CSDN专家-sinJack 2023-04-18 19:37关注
public class Computer { private String brand; private String model; private int year; private double price; public Computer(String brand, String model, int year, double price) { this.brand = brand; this.model = model; this.year = year; this.price = price; } public void turnOn() { System.out.println("The computer is turning on."); } public void turnOff() { System.out.println("The computer is turning off."); } public void printSpecs() { System.out.println("Brand: " + brand); System.out.println("Model: " + model); System.out.println("Year: " + year); System.out.println("Price: $" + price); } public static void main(String[] args) { Computer computer=new Computer("苹果电脑","16G内存",2023,12999); computer.printSpecs(); } }本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报 编辑记录