public class complex_c { public static int antal_komplexa_tal = 0; public complex_c() { this( 0, 0 ); } // complex_c public complex_c( float re, float im ) { this.re = re; this.im = im; complex_c.antal_komplexa_tal++; } // complex_c public void skriv_tal() { System.out.print( this.re + " + " + this.im + "i" ); } // skriv_tal private float re, im; public static void main( String args[] ) { complex_c cvektor[] = new complex_c[3]; for ( int index = 0; index < 3; index++ ) { cvektor[index] = new complex_c(); } // while System.out.println( complex_c.antal_komplexa_tal + " objekt allokerade." ); } // main } // class complex_c