public class Solution {
public static void main(String[] args) {
int nbre1=10;
int nbre2=3;
Chat chat1 = new Chat();
chat1.total=nbre1;
Chat.total=chat1.total;
Chat chat2 = new Chat();
chat2.total=nbre2;
Chat.total=nbre1 + nbre2;
System.out.println("Le nombre de chats est " + Chat.total);
}
public static class Chat {
public static int total = 0;
}
}
package fr.codegym.task.task04.task0407;
/*
Les chats dans l'univers
*/
public class Solution {
public static void main(String[] args) {
int nbre1=10;
int nbre2=3;
Chat chat1 = new Chat();
chat1.total=nbre1;
Chat.total=chat1.total;
Chat chat2 = new Chat();
chat2.total=nbre2;
Chat.total=nbre1 + nbre2;
System.out.println("Le nombre de chats est " + Chat.total);
}
public static class Chat {
public static int total = 0;
}
}