00001 00072 public class Beispiel1 { 00073 00074 00116 public static void main(String[] args) { 00117 00141 int n; 00142 float x; 00143 double z; 00144 boolean b; 00173 n = 10; 00174 n = n + 1; 00175 n = ( n +1 ) * n; 00176 00180 System.out.println("n = " + n); 00181 00182 System.out.println("Erster Aufrufparameter: " 00183 + args[0]); 00184 00185 00186 00187 00210 int a[] = new int[2]; 00211 00212 a[0] = 1; 00213 a[1] = 2; 00214 System.out.println("Array-Elemente: " 00215 + a[0] + " " + a[1]); 00216 00217 00223 float f[] = { 1.0f, 3.6f, 7.1f, 4.4f, 5.5f }; 00224 00225 boolean b2; 00226 b2 = true; 00227 b = false; 00228 00232 b = b && b2; 00233 00238 b = f[4] < f[0]; 00239 b = (f[0] == f[1]); 00240 00241 00255 if ( f[0] == f[1] ) { 00262 n = n +1; 00263 00264 } 00265 else { 00268 n = n + 2; 00269 00277 } 00278 00293 switch(n - 1) { 00294 00295 case 1: 00296 System.out.println("n-1 == 1"); 00297 break; 00298 00299 case 2: 00300 System.out.println("n-1 == 2"); 00301 break; 00302 00303 default: 00304 System.out.println("n-1 hat Wert " + (n - 1)); 00305 break; 00306 } 00307 00308 00309 00310 00311 00312 00313 00314 00323 int i; 00324 i = 0; 00325 while ( f[i] < f[i+1] && i < 4 ) { 00326 00327 System.out.println("f["+i+"] = " + f[i]); 00328 i = i + 1; 00329 00330 } 00331 00346 i = 0; 00347 do { 00348 b = f[i] < f[i+1]; 00349 if ( b ) { 00350 System.out.println("f["+i+"] = " + f[i]); 00351 } 00352 i = i + 1; 00353 } while ( b ) ; 00354 00355 00375 for ( int j=0; j < 4 && f[j] < f[j+1]; j = j + 1 ) { 00376 00377 if ( f[j] < f[j+1] ) { 00378 System.out.println("f["+j+"] = " + f[j]); 00379 } 00380 00381 } 00382 00383 } 00384 00385 }