This occurs when you attempt access an array with an illegal index... you are either passing in a negative number or a number larger than your array size.
Type: Posts; User: hackthisred
This occurs when you attempt access an array with an illegal index... you are either passing in a negative number or a number larger than your array size.
It looks to be 'type casting' your passed in parameter 's2'
Because in larger codes static methods are bad, when trying to trouble shoot code on an enterprise level. Besides I'd assume this method would be used inside a class without a main() lol.
So...
Then You must not have changed the type params or didn't import LinkList
Stack<Integer> pNum = new Stack<Integer>();
LinkedList<Integer> link = new LinkedList<Integer>(pNum);
Is perfectly...
Answer: Try using a LinkedList instead or even convert your Stack to a LinkedList... This gives you the libraries of both Stacks & Queues, Stacks being LIFO, and Queues being FIFO. :confused:
...
I'd recommend the following approach...:D
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class InputStuff {
private List<Integer> getUserInput()
There is a lot wrong with your code lol :-s For one it won't do anything, because you are calling methods that don't exist. Here is a good example that accomplishes something similar to what I...
ok... I'll answer the obvious... although I'm not sure what you are trying to accomplish your main method is wrong. Just remove the ';'
public static void main(String[] args)
{
double...
I wish I could say there is nothing wrong with your code, the formatting was horrendous :-s .... anyways try copying your code into notepad then paste it back into your IDE (eclipse). You might have...
There is. DJBENZ10 is using all sorts of java abnormalities to accomplish a seemly simple task, I simply posted a simple example as to how one might use a simple constructor. His post was at the very...
public class Shapes {
private int length;
private int width;
/**
* This a constructor for an object
* by which parameter are passed in at
* object's creation
* @param side1
Umm the answer is kinda obvious, you kinda already said it create a new List.
public class Stuff {
List<String> cards = new ArrayList<String>();
public void addCardToList (String...
wrap your code in code tags so we can see the code formatted as you would see it in you IDE. But I'd recommend you repost only the section of code that is giving you errors most of your methods have...
Try using a
strLine = (br.readLine().trim()) The trim method as part of the String library will remove any whitespace characters on the line you read into the buffer. Hope this helps :-?
Thanks for the insight, but the member had already solved their question; I was merely showing another method of accomplishing the exact same task in cleaner syntax.
I recommend using a List instead of an array for this operation, assuming you don't already know the number of entries that will be recorded from the file as input.
import java.io.BufferedReader;...
You will probably want to use a List so you can use sorting. This will give you a list of values from low to high, simply indicate the nth greatest value you wish to retrieve. It is simple and clean...
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class NumberValueComparison {
/**
* @param args