Java attribute define | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java attribute define

I need to define an attribute like Long district And this district attribute need to contain more than 10 values And each value's value update or increase count

10th Jun 2020, 8:13 PM
Powsikan Kanthasamy
Powsikan Kanthasamy - avatar
1 Answer
+ 1
write a class if values are of different types class District { Type1 t1; Type2 t2; } if there are values of same type and purpose use an array int[] num = new int[10]; or var data = new ArrayList<Type1>();
11th Jun 2020, 2:04 AM
zemiak