+ 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(); } }

14th May 2020, 4:47 AM
Shivam Rawal
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(); } }
14th May 2020, 7:15 AM
zemiak
0
Tysm
14th May 2020, 8:06 AM
Shivam Rawal