Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Constants.Friends[Integer.parseInt(custom.getFriendsList())]
- String[] MyList = {"One","Two","Three","Four"};
- int pos = Integer.parseInt(custom.getFriendsList());
- if (pos < 0 || pos >= Constants.Friends.length) {
- // Handle the error and exit or re-read the pos
- }
- // Accessing Friends[pos] is safe now:
- String friend = Constants.Friends[pos];
- int index = Integer.parseInt(custom.getFriendsList());
- if (index < 0 || index > list.length)
- {
- //notify user that input is invalid retry getting input
- }
- else
- {
- return list[index];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement