Commit edd01816 authored by updjx's avatar updjx

trying to fix disscusion comments

parent c1c61750
......@@ -2,28 +2,26 @@ class AttributeKill {
public A objectA;
public static void main(String[] args) {
/* create and construct object A*/
A objectA = new A();
objectA.init();
/* set object to null*/
objectA = null;
int a = objectA.atr;
/* calling uninitiated attribute of null object*/
int a = objectA.atr;
}
}
class A {
public int atr;
/* pseudo constructor */
public void init () {
public void init() {
atr = 2;
}
}
\ No newline at end of file
......@@ -4,13 +4,16 @@
*/
class NoParameterDeclaration {
public int a;
public static void main(String[] args) {
NoParameterDeclaration testObj = new NoParameterDeclaration();
/*there is no parameter given here*/
testObj.test();
}
public void test (int i) {
public void test(int i) {
int a = i;
}
......
class OverwriteAttributeWithUndeclaredVariable {
public static void main(String[] args) {}
public String a;
public void test () {
/*should break here because of undeclared unknown variable*/
int a = i;
public static void main(String[] args) {
OverwriteAttributeWithUndeclaredVariable obj = new OverwriteAttributeWithUndeclaredVariable();
obj.test();
}
public void test() {
/*should break here because of undeclared unknown variable*/
a = i;
}
}
class String {}
class String {
}
......@@ -3,7 +3,8 @@
*/
class RightVariable {
public static void main(String[] args) {}
public static void main(String[] args) {
}
public int Test;
......@@ -27,20 +28,19 @@ class RightVariable {
/*Overwrite test attribute with RightVariable class Attribute*/
test.Test = Test;
/*call local method with test*/
/*call class RightVariable method Test, with the test object declared in the current method*/
Test(test);
/*Overwrite class Test with with local method Test, with itself given as an obj ref..*/
test = Test(test);
}
}
class Test {
public int Test;
public void Test() {}
public void Test() {
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment