Salut les amis,
On peut avoir un constructeur dans un autre constructeur comme c'est le cas ici :
MERCI
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 public class Hello{ String title; int value; public Hello(){ title +="world";} public Hello(int value) this.value=value; title="Hello"; Hello();} public static void main(String[] args) { Hello c = new Hello(5); System.out.print(c.title); }}
Partager