<?xml version="1.0" encoding="UTF-8"?> | |||||
<module type="JAVA_MODULE" version="4"> | |||||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |||||
<exclude-output /> | |||||
<content url="file://$MODULE_DIR$"> | |||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |||||
</content> | |||||
<orderEntry type="inheritedJdk" /> | |||||
<orderEntry type="sourceFolder" forTests="false" /> | |||||
</component> | |||||
</module> |
public class HelloWorld { | |||||
public static void main(String[] args) { | |||||
int ZAHL = 0; | |||||
for (int i = 0; i < 200; i++) { | |||||
ZAHL++; | |||||
System.out.println(ZAHL); | |||||
if (ZAHL % 5 == 0) { | |||||
System.out.println(ZAHL + " ist durch 5 teilbar."); | |||||
} | |||||
String str = Integer.toString(ZAHL); //int zu String umwandeln | |||||
char c = str.charAt(str.length() - 1); //an der stelle 1 überprüfen | |||||
if (c == '9') { | |||||
System.out.println(ZAHL + " endet auf 9."); | |||||
} | |||||
int VORG = ZAHL - 1; | |||||
if ((ZAHL + VORG) %3 == 0){ | |||||
int ERG = (ZAHL + VORG); | |||||
System.out.println(ZAHL+ " und " + VORG + " addiert ergeben " + ERG+ " und " + ERG + " ist durch 3 teilbar" ); | |||||
} | |||||
} | |||||
Visitenkarte vis = new Visitenkarte(); | |||||
System.out.println(vis); | |||||
} | |||||
} |
public class Visitenkarte { | |||||
String name = "Kowalik"; | |||||
String vorname = "Tomasz"; | |||||
String beruf = "Student"; | |||||
String adresse = "Luisenstraße 14, 90762 Fürth"; | |||||
int alter = 27; | |||||
String telefonnummer = "01717075360"; | |||||
public String toString() { | |||||
String s = name + ", " + vorname + "\n" + beruf + "," + alter + "\n" + telefonnummer; | |||||
return s; | |||||
} | |||||
} | |||||