diff --git a/VL04_04/LokaleVars-C/.classpath b/VL04_04/LokaleVars-C/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..fceb4801b5ffa0e4a68c2b00441e45bf2eefdbed --- /dev/null +++ b/VL04_04/LokaleVars-C/.classpath @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/VL04_04/LokaleVars-C/.project b/VL04_04/LokaleVars-C/.project new file mode 100644 index 0000000000000000000000000000000000000000..28f4c0be59a41bdf35fa23db461552ff94621913 --- /dev/null +++ b/VL04_04/LokaleVars-C/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>LokaleVars-C</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/VL04_04/LokaleVars-C/.settings/org.eclipse.jdt.core.prefs b/VL04_04/LokaleVars-C/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..3a21537071bf4118b9e1ee864cb4bc258aa48211 --- /dev/null +++ b/VL04_04/LokaleVars-C/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/VL04_04/LokaleVars-C/src/inf3/LokaleVars.java b/VL04_04/LokaleVars-C/src/inf3/LokaleVars.java new file mode 100644 index 0000000000000000000000000000000000000000..7d5eba9857f26a2feaf9494489395e0bedd234ef --- /dev/null +++ b/VL04_04/LokaleVars-C/src/inf3/LokaleVars.java @@ -0,0 +1,32 @@ +/** +* LokaleVars.java +* +* Das Programm demonstriert die Möglichkeit Instanzvariablen und +* Variablen innerhalb von Methoden mit gleichem Namen zu deklarieren +* +* @author Steddin +* @version 1.00, 2017-11-19 +*/ +package inf3; + +class MyClass { + int value = 100; + void printValue() { + int value = 200; + System.out.println("Method printValue from MyClass: "+value); + if (value > 100) { + int value; + value = 10; + System.out.println("Method printValue from MyClass, inner block: "+value); + System.out.println("Method printValue from MyClass, "+ + "access to instance variable: "+ this.value); + } + } +} + +public class LokaleVars { + public static void main(String[] args) { + MyClass myClass = new MyClass(); + myClass.printValue(); + } +}