Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
repo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiawei Wang
repo
Commits
6ae39205
Commit
6ae39205
authored
2 years ago
by
Jiawei Wang
Browse files
Options
Downloads
Patches
Plain Diff
initial commit
parent
76affa1e
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Animal.java
+50
-0
50 additions, 0 deletions
src/Animal.java
src/Book.java
+1
-0
1 addition, 0 deletions
src/Book.java
src/Student.java
+71
-0
71 additions, 0 deletions
src/Student.java
with
122 additions
and
0 deletions
src/Animal.java
0 → 100644
+
50
−
0
View file @
6ae39205
public
class
Animal
{
private
String
name
;
public
Animal
(
String
name
)
{
super
();
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
@Override
public
String
toString
()
{
return
"Animal [name="
+
name
+
"]"
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
name
==
null
)
?
0
:
name
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
Animal
other
=
(
Animal
)
obj
;
if
(
name
==
null
)
{
if
(
other
.
name
!=
null
)
return
false
;
}
else
if
(!
name
.
equals
(
other
.
name
))
return
false
;
return
true
;
}
}
This diff is collapsed.
Click to expand it.
src/Book.java
+
1
−
0
View file @
6ae39205
...
...
@@ -92,3 +92,4 @@ public class Book {
}
}
This diff is collapsed.
Click to expand it.
src/Student.java
0 → 100644
+
71
−
0
View file @
6ae39205
public
class
Student
{
private
String
name
;
private
String
gender
;
private
String
CountryOfCitizenship
;
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
CountryOfCitizenship
==
null
)
?
0
:
CountryOfCitizenship
.
hashCode
());
result
=
prime
*
result
+
((
gender
==
null
)
?
0
:
gender
.
hashCode
());
result
=
prime
*
result
+
((
name
==
null
)
?
0
:
name
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
Student
other
=
(
Student
)
obj
;
if
(
CountryOfCitizenship
==
null
)
{
if
(
other
.
CountryOfCitizenship
!=
null
)
return
false
;
}
else
if
(!
CountryOfCitizenship
.
equals
(
other
.
CountryOfCitizenship
))
return
false
;
if
(
gender
==
null
)
{
if
(
other
.
gender
!=
null
)
return
false
;
}
else
if
(!
gender
.
equals
(
other
.
gender
))
return
false
;
if
(
name
==
null
)
{
if
(
other
.
name
!=
null
)
return
false
;
}
else
if
(!
name
.
equals
(
other
.
name
))
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
"Student [name="
+
name
+
", gender="
+
gender
+
", CountryOfCitizenship="
+
CountryOfCitizenship
+
"]"
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getGender
()
{
return
gender
;
}
public
void
setGender
(
String
gender
)
{
this
.
gender
=
gender
;
}
public
String
getCountryOfCitizenship
()
{
return
CountryOfCitizenship
;
}
public
void
setCountryOfCitizenship
(
String
countryOfCitizenship
)
{
CountryOfCitizenship
=
countryOfCitizenship
;
}
public
Student
(
String
name
,
String
gender
,
String
countryOfCitizenship
)
{
super
();
this
.
name
=
name
;
this
.
gender
=
gender
;
CountryOfCitizenship
=
countryOfCitizenship
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment