添加.jar文件
/** * encoding: utf-8 * 版权所有 2023 涂聚文有限公司 * 许可信息查看: * 描述: * # Author : geovindu,Geovin Du 涂聚文. * # IDE : Apache NetBeans IDE 19 windows 10 Java 17 * # Datetime : 2023 - 2023/11/16 - 12:29 * # User : geovindu * # Product : Apache NetBeans * # Project : javademo * # File : User.java 类 * # explain : 学习 **/ package Model; import java.util.Objects; /** *用户 * @author geovindu */ public class User { /** *姓名 */ private String name; /** *职业 */ private String occupation; /** *兄弟姐妹有几人 */ private int siblings; /** *身高 */ private double height; /** *结婚否 */ private boolean married; /** * * @param name * @param occupation * @param siblings * @param height * @param married */ public User(String name, String occupation, int siblings, double height, boolean married) { this.name = name; this.occupation = occupation; this.siblings = siblings; this.height = height; this.married = married; } /** *获取姓名 * @return */ public String getName() { return name; } /** *设置姓名 * @param name */ public void setName(String name) { this.name = name; } /** * * @return */ public String getOccupation() { return occupation; } /** * * @param occupation */ public void setOccupation(String occupation) { this.occupation = occupation; } /** * * @return */ public int getSiblings() { return siblings; } /** * * @param siblings */ public void setSiblings(int siblings) { this.siblings = siblings; } /** * * @return */ public double getHeight() { return height; } /** * * @param height */ public void setHeight(double height) { this.height = height; } /** * * @return */ public boolean isMarried() { return married; } /** * * @param married */ public void setMarried(boolean married) { this.married = married; } /** * * @param o * @return */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; return siblings == user.siblings && Double.compare(user.height, height) == 0 && married == user.married && Objects.equals(name, user.name) && Objects.equals(occupation, user.occupation); } /** * * @return */ @Override public int hashCode() { return Objects.hash(name, occupation, siblings, height, married); } /** * * @return */ @Override public String toString() { final StringBuilder sb = new StringBuilder("User{"); sb.append("name='").append(name).append('\''); sb.append(", occupation='").append(occupation).append('\''); sb.append(", siblings=").append(siblings); sb.append(", height=").append(height); sb.append(", married=").append(married); sb.append('}'); return sb.toString(); } }
project.xml:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://www.netbeans.org/ns/project/1"> <type>org.netbeans.modules.java.j2seproject</type> <configuration> <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> <name>JavaDemo</name> <source-roots> <root id="src.dir"/> </source-roots> <test-roots> <root id="test.src.dir"/> </test-roots> </data> <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1"> <definitions> <!-- https://mvnrepository.com/artifact/jfree/jfreechart --> <dependency> <groupId>jfree</groupId> <artifactId>jfreechart</artifactId> <version>1.0.1</version> </dependency> <!-- https://mvnrepository.com/artifact/jfree/jfreechart --> <dependency> <groupId>jfree</groupId> <artifactId>jfreechart</artifactId> <version>1.0.0</version> </dependency> <!-- https://mvnrepository.com/artifact/jfree/jcommon --> <dependency> <groupId>jfree</groupId> <artifactId>jcommon</artifactId> <version>1.0.0</version> </dependency> <!-- https://mvnrepository.com/artifact/com.darwinsys/darwinsys-api --> <dependency> <groupId>com.darwinsys</groupId> <artifactId>darwinsys-api</artifactId> <version>1.7.6</version> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.16.0</version> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.16.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.json/json --> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20231013</version> </dependency> </definitions> </libraries> </configuration> </project>
标签:return,name,19,married,Apache,siblings,IDE,public,occupation From: https://www.cnblogs.com/geovindu/p/17837894.html