题海
让大学四年没有难题
首页
搜题
登陆
题目详情
简答题
请画出组成关系的UML类图,并用Java语言写出组成关系程序结构
查看答案
学科:
默认课程
时间:
2026-05-21 06:45:57
相关题目
相关作业
题目1
填空题
下图中,类A与类T是( )关系;类A与接口IX是( )关系;类A与类B、类C和接口IX是( )关系.<img src="https://tihai-oss-cloud.itihey.com/img/59f96e217ca4a82bd6e74e3da067416d.png">
题目2
请阅读程序,写出程序运行结果.//写出程序运行结果class Eye {// 猫的眼睛类 private String color; public Eye(String color) { this.color = color; }}class Cat {// 猫类 private String name; private Eye eye; public Cat(String name, Eye eye) { this.name = name; this.eye = eye; } public boolean equals(Object obj) { Cat cat = (Cat) obj; if (this.name.equals(cat.name) && this.eye == cat.eye) return true; return false; }} public class CatDemo { public static void main(String[] args) { Eye e1=new Eye("蓝色"); Eye e2=new Eye("蓝色"); Cat tom=new Cat("Tome",e1); Cat jack=new Cat("Jack",e2); System.out.println(tom==jack); System.out.println(tom.equals(jack)); }}
题目3
阅读程序,写出程序运行结果.//写出程序运行结果class Eye {// 猫的眼睛类 private String color; public Eye(String color) { this.color = color; }}class Cat {// 猫类 private String name; private Eye eye; public Cat(String name, Eye eye) { this.name = name; this.eye = eye; } public boolean equals(Object obj) { Cat cat = (Cat) obj; if (this.name.equals(cat.name) && this.eye == cat.eye) return true; return false; }}public class CatDemo { public static void main(String[] args) { Eye e1=new Eye("蓝色"); Eye e2=new Eye("蓝色"); Cat tom1=new Cat("Tom",e1); Cat tom2=new Cat("Tom",e2); System.out.println(tom1==tom2); System.out.println(tom1.equals(tom2)); }}
题目4
阅读程序,写出程序运行结果.//写出程序运行结果class Eye {// 猫的眼睛类 private String color; public Eye(String color) { this.color = color; }} class Cat {// 猫类 private String name; private Eye eye; public Cat(String name, Eye eye) { this.name = name; this.eye = eye; } public boolean equals(Object obj) { Cat cat = (Cat) obj; if (this.name.equals(cat.name) && this.eye == cat.eye) return true; return false; }} public class CatDemo { public static void main(String[] args) { Eye e1=new Eye("蓝色"); Cat tom1=new Cat("Tom",e1); Cat tom2=new Cat("Tom",e1); System.out.println(tom1==tom2); System.out.println(tom1.equals(tom2)); }}
题目5
阅读程序,写出程序运行结果.//写出程序运行结果class Eye {// 猫的眼睛类 private String color; public Eye(String color) { this.color = color; } public boolean equals(Object obj) { Eye e=(Eye) obj; if(this.color.equals(e.color)) return true; return false; }} class Cat {// 猫类 private String name; private Eye eye; public Cat(String name, Eye eye) { this.name = name; this.eye = eye; } public boolean equals(Object obj) { Cat cat = (Cat) obj; if (this.name.equals(cat.name) && this.eye.equals(cat.eye)) return true; return false; }} public class CatDemo { public static void main(String[] args) { Eye e1=new Eye("蓝色"); Eye e2=new Eye("蓝色"); Cat tom1=new Cat("Tom",e1); Cat tom2=new Cat("Tom",e1); System.out.println(tom1==tom2); System.out.println(tom1.equals(tom2)); }}
题目6
阅读程序,写出程序运行结果.//写出程序运行结果class Leg {// 腿 private int length; public Leg(int length) { this.length = length; } public int getLength() { return length; } public void setLength(int length) { this.length = length; }}class Head {// 头 private String type;// 类型 public Head(String type) { this.type = type; } public String getType() { return type; } public void setType(String type) { this.type = type; }} class Person { private String name;// 姓名 private char sex;// 性别 private Leg leg;//腿 private Head head;//头 public Person(String name) { this.name = name; } public Person(String name, char sex) { this(name); this.sex=sex; } public Leg getLeg() { return leg; } public void setLeg(Leg leg) { this.leg = leg; } public Head getHead() { return head; } public void setHead(Head head) { this.head = head; } public String getPerson() { StringBuffer sb=new StringBuffer(); sb.append(this.name+leg.getLength()+head.getType()); return sb.toString(); }}//测试类public class DogDemo { public static void main(String[] args) { Leg leg=new Leg(30); Head head=new Head("国字脸"); Person zhangfei=new Person("张飞",'男'); zhangfei.setLeg(leg); zhangfei.setHead(head); leg.setLength(80); System.out.println(zhangfei.getPerson()); }}
题目7
一台计算机由CPU、硬盘、内存、主板和电源等部件组成.请分析该问题抽象出类,然后用UML类图表示类之间的关系,并用Java语言实现.(建模为组成关系)
题目8
简答题
请画出组成关系的UML类图,并用Java语言写出组成关系程序结构
下载
题海APP
拍照搜题更快捷
海量题库
无搜索限制
快捷拍照搜题
扫描他!然后带走我~