Click here to Skip to main content
15,887,331 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Somebody please help me about this case. i got java error like the title when i try run this code:

Java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class test {

	static List<String> skill = new ArrayList<String>();//this must be String
	
	public static void main(String[] args) {
		skill.add("1:123 456");//input value cannot change
		System.out.println(getSkills());
	}
	
	public static List<StigmaSkill> getSkills() {
		List<StigmaSkill> list = new ArrayList<StigmaSkill>();
		
		for (String st : skill) {
			String[] array = st.split(":");
			int aInt = Integer.parseInt(Arrays.deepToString(array[1].split("\\s+")));
			list.add(new StigmaSkill(aInt));
		}
		return list;//return from string to integer value
	}
	
	private static class StigmaSkill {
		
		private int skillId;
		
		public StigmaSkill(int skillId) {
			this.skillId = skillId;
		}

		public int getSkillId() {
			return this.skillId;
		}
	}
}


Please help me figure out and solve my problem. thanks in advance
Posted
Comments
EADever 7-Aug-15 23:26pm    
im forget this: output value must be integer in list (eg. [123, 456])

1 solution

Please do not repost the same question. You have already been given some suggestions in your original post.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900