Commit a6ef71dc authored by updjx's avatar updjx

fixing according to comments

- adding static main String[]
- public for all attributes
- changing comments from one line// to /*
parent fccb50d4
......@@ -4,7 +4,7 @@ class AttributeKill {
public A objectA;
public static void main(String args[]) {
public static void main(String[] args) {
A objectA = new A();
objectA.init();
......@@ -13,7 +13,7 @@ class AttributeKill {
A objectA = new A();
//should be null (not intiateated)
/*should be null (not intiateated)*/
int a = objectA.atr;
}
......@@ -22,16 +22,12 @@ class AttributeKill {
}
class A {
int atr;
public int atr;
//pseudo constructor
/* pseudo constructor */
public void init () {
atr = 2;
}
}
}
\ No newline at end of file
......@@ -6,14 +6,14 @@ class AttributeOrSystem {
public int System;
public static void main(String args[]) {
public static void main(String[] args) {
A objA = new objA();
objA.init();
System.out.println(objA.atr)
System.out.println(objA.atr);
}
......@@ -21,7 +21,7 @@ class AttributeOrSystem {
}
class A {
int atr;
public int atr;
public void init () {
......
class BooleanSystemPrint {
public void test (int i) {
public static void main(String[] args) {
BooleanSystemPrint testObj = new BooleanSystemPrint();
testObj.test();
}
public void test (int i) {
int a = i;
Boolean a = true;
System.out.println(a);
}
}
......
......@@ -4,10 +4,10 @@
class CompareClassAttributes {
public A objectA;
public B object B;
public B objectB;
public static void main(String args[]) {
public static void main(String[] args) {
objectA.init();
objectB.init();
......@@ -28,7 +28,7 @@ class CompareClassAttributes {
}
class A {
int atr;
public int atr;
public void init () {
......@@ -41,7 +41,7 @@ class A {
class B {
int atr;
public int atr;
public void init () {
......
......@@ -3,6 +3,12 @@
*/
class LocalInitClass {
public static void main(String[] args) {
LocalInitClass test = LocalInitClass();
test.algorithm();
}
public int algorithm() {
......@@ -11,7 +17,7 @@ class LocalInitClass {
}
}
//maybe as inner class?
/*maybe as inner class?*/
class Test{
......
......@@ -11,8 +11,15 @@ class LocalVariableOverwriteAttribute {
int localVar = varInt;
//is System global and in standart miniJava?
//System.out.println(localVar)
System.out.println(localVar);
}
public static void main(String[] args) {
LocalVariableOverwriteAttribute test = LocalVariableOverwriteAttribute();
test.algorithm();
}
......
......@@ -5,8 +5,6 @@ class NoConstructedObjectCall {
public void test() {
A objA = new objA();
......@@ -19,7 +17,7 @@ class NoConstructedObjectCall {
}
class A {
int atr;
public int atr;
public void init () {
......
......@@ -2,17 +2,14 @@
class OverwriteWithnonedecalredVariable {
String a;
public String a;
public void test () {
//should break here i -not present
/*should break here because of undeclared unknown variable*/
int a = i;
// System.out.println(a);
}
}
......
......@@ -3,7 +3,7 @@
*/
class RightVariable {
Test Test;
public Test Test;
......@@ -14,6 +14,15 @@ class RightVariable {
}
public static void main(String[] args) {
RightVariable test = RightVariable();
test.Test();
test.Test;
Test test = new Test();
}
}
......
......@@ -3,7 +3,6 @@
*/
class VoidAttribute {
public void a;
}
......
......@@ -2,7 +2,7 @@ class WrongReturnTypeVoid {
public void a() {
//should not allow return of integer
/*should not allow return of integer*/
return 5;
}
......
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