- 3

Drag and drop from the options below to create a valid Java code with encapsulation. public class Person { int age;

Drag and drop from the options below to create a valid Java code with encapsulation. public class Person { int age; void setAge( age) { if (age > 0) { this.age = age; } } } public static int private String final

10th Jul 2017, 2:05 PM
Walter Mugo
Walter Mugo - avatar
13 Réponses
+ 5
public class Person { private int age; public void setAge(int age) { if(age > 0) { this.age = age; Rember that you habe to use "private" to achieve encapsulation in Java (that's why private is the first word). setAge is a public void (you don't need to hide it, as it was done for int age for the encapsulation ). Age is represented as an integer number (in java integer = int). The tird word is int. I hope it helped!
11th Jul 2017, 12:22 PM
Zenkli
Zenkli - avatar
+ 2
interger, new, ArrayList
3rd May 2018, 5:46 AM
Brayan Caceres Torres
Brayan Caceres Torres - avatar
+ 2
to declare an ArrayList to hold 9 Integers: interger new ArrayList
10th Mar 2021, 11:35 PM
Rusz Tamás
Rusz Tamás - avatar
0
Here is the answer interger new ArrayList
28th May 2018, 8:14 AM
Mohammadalaminsiam
Mohammadalaminsiam - avatar
0
1 iterator 2 integer 3 iterator 4 hasnext 5 next
20th Jul 2018, 8:43 AM
fayis kottakkal
fayis kottakkal - avatar
0
That Epic!
24th May 2019, 1:26 AM
Zac
0
mali yung iba
12th Sep 2019, 6:53 AM
Jaypee Fuentes
Jaypee Fuentes - avatar
0
public class room public int/*
12th Sep 2019, 6:54 AM
Jaypee Fuentes
Jaypee Fuentes - avatar
0
Drag and drop from the options below to create a valid Java code with encapsulation. public class Person { private int age; public void setAge(int age) { if (age > 0) { this.age = age; } } } Enjoy
20th May 2020, 2:01 PM
Reza Febriansyah
Reza Febriansyah - avatar
0
linkedlist string hey 0
17th Aug 2020, 2:46 PM
kedir.y
kedir.y - avatar
0
interger new ArrayList
1st Jan 2022, 11:45 AM
M.I.M.Aqueel
M.I.M.Aqueel - avatar
0
Drag and drop from the options below to create a valid Java code with encapsulation. public class Person { private int age; public void setAge(int age) { if (age > 0) { this.age = age; } } }
30th Jun 2022, 6:27 PM
Opanuga Stephen
Opanuga Stephen - avatar
0
public class Person { private int age; public void setAge(int age) { if (age > 0) { this.age = age; } } }
19th Jul 2022, 2:59 PM
Prajjwal Gurav
Prajjwal Gurav - avatar