ayuda con errores de programa
Publicado por LUIS ENRIQUE (1 intervención) el 16/06/2015 21:07:18
que tal me encargaron esta tarea pero por mas que le busco no logro encontrar los errores y porque no compila podrian ayudarme
-------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class Scope {
private int i = 1;
public void firstMethod() {
int i;
int j = 5;
this.i = i + j;
System.out.println("this.i = " + this.i);
System.out.println("i = " + i);
secondMethod(this.i);
}
public void secondMethod(int i) {
int j = 8;
i = i + j;
System.out.println("this.i = " + this.i);
System.out.println("i = " + i);
}
public int getVariable() {
return i;
}
}
-------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
public class TestScope {
public static void main(String args[]){
Scope scope = new Scope();
System.out.println("i = " + scope.getVariable());
scope.firstMethod();
System.out.println("i = " + scope.getVariable());
}
}
Valora esta pregunta


0