lab7
This commit is contained in:
BIN
test/Cat.class
Normal file
BIN
test/Cat.class
Normal file
Binary file not shown.
27
test/Cat.java
Normal file
27
test/Cat.java
Normal file
@ -0,0 +1,27 @@
|
||||
public class Cat {
|
||||
protected String name;
|
||||
protected String color;
|
||||
|
||||
|
||||
public Cat (String name, String color) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String catName) {
|
||||
name = catName;
|
||||
}
|
||||
|
||||
public String catSays() {
|
||||
return "Meow";
|
||||
}
|
||||
|
||||
}
|
6
test/CatTest.java
Normal file
6
test/CatTest.java
Normal file
@ -0,0 +1,6 @@
|
||||
public class CatTest {
|
||||
public static void main(String[] args) {
|
||||
Cat orangesmall = new Orange("Turuncu");
|
||||
System.out.println(orangesmall.getColor()+" rengi ismi de: "+orangesmall.getName()+" ve kilosu: "+orangesmall.Weight());
|
||||
}
|
||||
}
|
BIN
test/Orange.class
Normal file
BIN
test/Orange.class
Normal file
Binary file not shown.
13
test/Orange.java
Normal file
13
test/Orange.java
Normal file
@ -0,0 +1,13 @@
|
||||
public class Orange extends Cat
|
||||
{
|
||||
private int weight = 5;
|
||||
|
||||
|
||||
public Orange (String name) {
|
||||
super(name, "Orange");
|
||||
}
|
||||
|
||||
public int Weight() {
|
||||
return weight;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user