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?

16th Nov 2018, 8:48 PM
Egbert Jan Kuijlaars
1 Antwort
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 */
18th Nov 2018, 12:39 PM
Nopal Opal
Nopal Opal - avatar