+ 1
Please correct my code
public class Program { class Cat{ int legs; int eyes; int maxOf(int a,int b){ if(a>b){ return a; }else{ return b; } } public void description(){ System.out.print("my cat has "+ legs +" "+ eyes); } } public static void main(String[] args) { Cat pussy = new Cat (); legs =maxOf(4,3); eyes = maxOf(1,2); pussy.description(); } }
2 ответов
+ 1
class Cat {
...
}
public class Program {
public static void main(String[] args) {
Cat pussy = new Cat();
// legs = maxOf(4, 3);
// eyes = maxOf(1, 2);
pussy.legs = pussy.maxOf(4, 3);
pussy.eyes = pussy.maxOf(1, 2);
pussy.description();
}
}
0
Tysm