BAEL-6154: Migrate from Java 8 to Java 17 + tests (#13474)
This commit is contained in:
committed by
GitHub
parent
dbcda877c9
commit
219915aeb2
@@ -0,0 +1,40 @@
|
||||
package com.baeldung.java8to17;
|
||||
|
||||
public class Address {
|
||||
|
||||
private String street;
|
||||
private String city;
|
||||
private String pin;
|
||||
|
||||
public Address(String street, String city, String pin) {
|
||||
super();
|
||||
this.street = street;
|
||||
this.city = city;
|
||||
this.pin = pin;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getPin() {
|
||||
return pin;
|
||||
}
|
||||
|
||||
public void setPin(String pin) {
|
||||
this.pin = pin;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.baeldung.java8to17;
|
||||
|
||||
public record Circle(double radius) implements Shape {
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.baeldung.java8to17;
|
||||
|
||||
public class Person {
|
||||
|
||||
private String name;
|
||||
private Address address;
|
||||
|
||||
public Person(String name, Address address) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.baeldung.java8to17;
|
||||
|
||||
public record Rectangle(double length, double width) implements Shape {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.baeldung.java8to17;
|
||||
|
||||
public interface Shape {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.baeldung.java8to17;
|
||||
|
||||
public record Student(int rollNo, String name) {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user