<?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 Visitenkarte { | |||||
String s; | |||||
String name = "Felix"; | |||||
String vorname = "Raab"; | |||||
String adresse = "Sigmund-Graff-Str.2"; | |||||
int telefonnummer = 8908265; | |||||
int alter = 22; | |||||
String beruf = "Student"; | |||||
public String toString(){ | |||||
System.out.println("-----"); | |||||
String s = (name + "," + vorname + "\n" + beruf + "," + alter + "\n" + adresse + "\n" + telefonnummer + "\n") ; | |||||
return s; | |||||
} | |||||
} |
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"); | |||||
} | |||||
//endung auf 9 | |||||
String str = Integer.toString(zahl); | |||||
char last = str.charAt(str.length() - 1); | |||||
if (last == '9') { | |||||
System.out.println(zahl + " endet auf 9"); | |||||
} | |||||
//teilbar durch 3 | |||||
int vorgaenger = zahl - 1; | |||||
if ((zahl + vorgaenger) % 3 == 0) { | |||||
int ergebnis = (zahl + vorgaenger); | |||||
System.out.println(zahl + " und " + vorgaenger + " addiert ergeben " + ergebnis + " und " + ergebnis + " ist durch 3 teilbar"); | |||||
} | |||||
} | |||||
System.out.println(" "); | |||||
Visitenkarte karte = new Visitenkarte(); | |||||
System.out.println(karte); | |||||
} | |||||
} |