update example file

This commit is contained in:
Krauß, Josefine 2024-07-04 11:07:22 +02:00
parent 7fb7cea2f7
commit dbb61e2a81

View File

@ -1,4 +1,4 @@
public class FieldAccessAndMethodCalls {
class FieldAccessAndMethodCalls {
public static void main(String[] args) {
Class1 c1 = new Class1();
int i = c1.c2.c3.m3(1).m2().m1();
@ -6,10 +6,10 @@ public class FieldAccessAndMethodCalls {
}
}
public class Class1{
class Class1{
int i1;
Class2 c2;
public Class1{
public Class1() {
this.c2 = new Class2();
}
public int m1(){
@ -17,24 +17,21 @@ public class Class1{
}
}
public class Class2{
class Class2{
int i2;
Class3 c3;
public Class3{
public Class2(){
this.c3 = new Class3();
}
public Class1 m2(){
Class1 c1 = new Class2();
Class1 c1 = new Class1();
c1.i1 = i2;
return c1;
}
}
public class Class3{
class Class3{
int i3;
public Class3(int i){
this.i1 = i;
}
public Class2 m3(int i){
Class2 c2 = new Class2();
c2.i2 = i;