int Mnum0,Mnum1,Mnum2,Mnum3,Mnum4,Mnum5,Mnum6,,,,,,,,,,,,,,,,,,,
for(int h=0;h<Mnum0.length;h++)
for(int h=0;h<Mnum1.length;h++)
for(int h=0;h<Mnum2.length;h++)
for(int h=0;h<Mnum3.length;h++).
for(int h=0;h<Mnum4.length;h++)
Repeat statement above
for(int i=0; i<100; i++)
{
for(int h=0;h<Mnumi.length;h++) /// Replace the number part of Mnum with the variable i (Mnumi)
}
How do I respond to the number of iterations of a variable like this?
Question about generating dynamic variables.
java for
Study reflection.
You can access the field as a string to obtain a value.
http://tutorials.jenkov.com/java-reflection/fields.html
List<String> list = new ArrayList<>(Arrays.asList("a","bb","ccc","dddd"));
for (int i = 0; i < list.size(); i++) {
for (int j = 0; j < list.get(i).length(); j++) {
System.out.print(list.get(j));
}
System.out.println();
}
Put it in an array or list and look at the index
© 2024 OneMinuteCode. All rights reserved.