Type: Posts; User: hackthisred

Search: Search took 1.02 seconds.

  1. Re: Pleas help! array index out of bouderies

    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.
  2. Re: What does this short part of a code do?

    It looks to be 'type casting' your passed in parameter 's2'
  3. [SOLVED] Re: reading a stream of numbers from standard input

    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.

  4. Re: how could I display a stack as FIFO instead of LIFO

    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...
  5. Re: how could I display a stack as FIFO instead of LIFO

    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:

  6. [SOLVED] Re: reading a stream of numbers from standard input

    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()
  7. Replies

    Re: What is wrong with this code?

    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...
  8. Re: I included the main method, but it keeps flashing that I don't have one included?

    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)
  9. Re: java.lang.NoClassDefFoundError exception

    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...
  10. Replies

    Re: Please help!

    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...
  11. Replies

    Re: Please help!

    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
  12. Re: I need a little help with a boolean method.

    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...
  13. Replies

    Re: what is wrong with my code? need help

    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...
  14. Replies

    Re: problems with equals method.

    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 :-?
  15. Replies

    Re: The nth highest number from a list

    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.
  16. Replies

    Re: Please help with my code

    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.

  17. Replies

    Re: The nth highest number from a list

    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...
  18. Replies

    Re: Need help with Question

    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.List;
    import java.util.Scanner;

    public class NumberValueComparison {

    * @param args
Results 1 to 18 of 21