### IntelliJ IDEA ### | |||||
out/ | |||||
!**/src/main/**/out/ | |||||
!**/src/test/**/out/ | |||||
### Eclipse ### | |||||
.apt_generated | |||||
.classpath | |||||
.factorypath | |||||
.project | |||||
.settings | |||||
.springBeans | |||||
.sts4-cache | |||||
bin/ | |||||
!**/src/main/**/bin/ | |||||
!**/src/test/**/bin/ | |||||
### NetBeans ### | |||||
/nbproject/private/ | |||||
/nbbuild/ | |||||
/dist/ | |||||
/nbdist/ | |||||
/.nb-gradle/ | |||||
### VS Code ### | |||||
.vscode/ | |||||
### Mac OS ### | |||||
.DS_Store |
# Default ignored files | |||||
/shelf/ | |||||
/workspace.xml | |||||
# Editor-based HTTP Client requests | |||||
/httpRequests/ | |||||
# Datasource local storage ignored files | |||||
/dataSources/ | |||||
/dataSources.local.xml |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK"> | |||||
<output url="file://$PROJECT_DIR$/out" /> | |||||
</component> | |||||
</project> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="ProjectModuleManager"> | |||||
<modules> | |||||
<module fileurl="file://$PROJECT_DIR$/untitled.iml" filepath="$PROJECT_DIR$/untitled.iml" /> | |||||
</modules> | |||||
</component> | |||||
</project> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="VcsDirectoryMappings"> | |||||
<mapping directory="$PROJECT_DIR$" vcs="Git" /> | |||||
</component> | |||||
</project> |
import java.util.Arrays; | |||||
public class HelloWorld { | |||||
public static void main(String[] args) { | |||||
System.out.println("Hello World"); | |||||
} | |||||
} |
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or | |||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter. | |||||
public class Main { | |||||
public static void main(String[] args) { | |||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text | |||||
// to see how IntelliJ IDEA suggests fixing it. | |||||
System.out.println("Hello and welcome!"); | |||||
for (int i = 1; i <= 5; i++) { | |||||
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint | |||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>. | |||||
System.out.println("i = " + i); | |||||
} | |||||
} | |||||
} |
public class Zahlenfilter { | |||||
public static void main(String[] args) { | |||||
Filter filter1 = new Filter(); | |||||
filter1.zahlenfiltern(); | |||||
} | |||||
} | |||||
class Zahl { | |||||
private int value; | |||||
public Zahl(int value) { | |||||
this.value = value; | |||||
} | |||||
public int getValue() { | |||||
return value; | |||||
} | |||||
public boolean istDurchFuenfTeilbar() { | |||||
return value % 5 == 0; | |||||
} | |||||
public boolean endetAufNeun() { | |||||
return value % 10 == 9; | |||||
} | |||||
public int addieren(Zahl other) { | |||||
return this.value + other.getValue(); | |||||
} | |||||
public boolean istDurchDreiTeilbar() { | |||||
return (value + (value - 1)) % 3 == 0; | |||||
} | |||||
} | |||||
class Filter { | |||||
public void zahlenfiltern() { | |||||
Zahl zahl; | |||||
Zahl vorherigeZahl = new Zahl(0); | |||||
for (int i = 0; i <= 300; i++) { | |||||
zahl = new Zahl(i); | |||||
if (zahl.istDurchFuenfTeilbar()) { | |||||
System.out.println(i + " ist durch 5 teilbar"); | |||||
} else { | |||||
if (zahl.endetAufNeun()) { | |||||
System.out.println(i + " endet auf 9"); | |||||
} else { | |||||
int summe = zahl.addieren(vorherigeZahl); | |||||
if (zahl.istDurchDreiTeilbar()) { | |||||
System.out.println(i + " und " + (i - 1) + " addiert ergeben " + summe + " und " + summe + " ist durch 3 teilbar"); | |||||
} else { | |||||
System.out.println(i + 1); | |||||
} | |||||
} | |||||
} | |||||
vorherigeZahl = zahl; | |||||
} | |||||
} | |||||
} |
<?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> |