Skip to content
Snippets Groups Projects
Commit 421bf8cf authored by Sven Steddin's avatar Sven Steddin
Browse files

Ergaenzung weiteres Beispielprojekt

parent 212a1084
No related branches found
No related tags found
No related merge requests found
<?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>
<?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>
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
/**
* 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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment