0
Is there a difference between atributes and parameters in Java?
If you assign a parameter "name" to a method is the parameter always an attribute?
1 Resposta
0
atribute is data member/instance variable, parameter is a value that belongs to method declaration and argument is value that passed to the method
class dewa{
int a; // <-- this is attribute
void call(int a){ // <-- this is parameter
System.out.println(a*a);
}
}
public class tc {
public static void main(String...Naufal) {
dewa b = new dewa(); // <-- and this is argument
b.call(5);
}
}
/*
Output:
25
*/