Leave a Reply 2

Your email address will not be published. Required fields are marked *


xxx

xxx

class Cake {
String flavor;
int model;
Cake(){
model = 0;
flavor = “Unknown”;
}

}

public class Access {
public static void main(String[] args){
Cake c = new Cake();
bake1(c);
System.out.println(c.model + ” ” + c.flavor);
bake2(c);
System.out.println(c.model + ” ” + c.flavor);
}
public static Cake bake1(Cake c){
c.flavor = “strawberry”;
c.model = 1200;
return c;

}
public static void bake2(Cake c){
c.flavor = “chocolate”;
c.model = 1230;
return;

}
}

d