I need help with set method at Arraylist. I have ArrayList of class and I need to change atribute of this class in whole list. I want to use normal loop but problem is with set method. In code is just seriously easied version of real thing what I am doing but principal is same. I have no idea how to help and google didn't help:( Thanks for your help
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package procvicovanizakladu;
import java.util.ArrayList;
/**
For fun nejake zakladni operace a operandy. Tak si to vyzkousime
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
ArrayList<Pokus> a = new ArrayList<Pokus>();
a.add(new Pokus(5));
a.add(new Pokus(10));
a.add(new Pokus(15));
a.add(new Pokus(20)); //Adding files
a.set(index, null);)/> ///////Index is for sure, but how to change attribute c in class Pokus to any diffrend number?
for(int i = 0 < a.size() ; i++)
{
System.out.println(a.get(i).c);
}
}
}
And class Pokus:
package procvicovanizakladu;
/**
*
* @author Puštík
*/
public class Pokus {
int c;
public Pokus (int B)/>
{
c = b;
}
}

New Topic/Question
Reply



MultiQuote





|