Type: Posts; User: pbrockway2

Page 1 of 20 1 2 3 4

Search: Search took 0.29 seconds.

  1. Replies

    [SOLVED] Re: cannot find symbol (javac)

    It's possible, it's just not very logical.

    When you declare a to be Animal[] you are specifying the type of a. You are saying "this is an array of animals", you are not saying "this is an array...
  2. Replies

    [SOLVED] Re: cannot find symbol (javac)

    If you intend the Animal instances that you put in to the array to eat, then you could declare Animal to implement the Behavior interface:

    public abstract class Animal implements Behavior {
  3. [SOLVED] Re: Does anyone know any good .ogg libraries?

    Don't worry (if indeed you are!) about my comments: just being argumentative...

    I'm glad you've found the LGPL more suitable. If any actual money depends on it then I would guess a lawyer's word...
  4. [SOLVED] Re: Does anyone know any good .ogg libraries?

    Which part of the LGPL are you referring to?

    I really am no expert about this stuff but my understanding is that having a LGPL library as a jar archive on the classpath and using the methods it...
  5. Re: Late night headache maker-unknown error

    nextInt() will throw an exception under various conditions which are described in the API documentation. Specifically if you enter letters then what results is not an int (or as the docs put it "the...
  6. [SOLVED] Re: Does anyone know any good .ogg libraries?

    I'm no expert, but I thought LGPL was specifically supposed to allow for open source libraries as part of unfree software.

    There's no irony: copyleft fully intends to be draconian about being open.
  7. Replies

    [SOLVED] Re: cannot find symbol (javac)

    It makes the code easier to read if you follow Java conventions and begin variables with a lowercase letter.

    In main() you declare x to be of type Animal, but then use it to call an Eat() method. ...
  8. Replies

    [SOLVED] Re: Need help with Java homework

    You seem to be on the right track. Although I agree with Norm, the invalidArg string isn't really doing anything. You set it equal to the string consisting of a single space and later check if its...
  9. Replies

    [SOLVED] Re: Need help with Java homework

    Nothing so far suggests that the reference should be used. (I might have missed something, or the question may contain more instructions.) So you can simply say:

    public static void...
  10. Re: how to run your program outside of your compiler?

    There is an example at which is part of the General Java Development Learning Trail.

    Although Netbeans provides a pretty comprehensive example which directly addresses your question,...
  11. Re: How to find the needed info from Java API documentation

    One thing to do is, whenever you are using a new method and consulting the API documentation, read the description of the other methods in a class and perhaps the introductory text to the page of...
  12. Re: java program that prints out taylor series for mathematical constant e

    Beware integer division! 1/factorial will generally be zero (except for the very rare case when it's one). So

    result=result+1/factorial*n; // result=result+0*n, ie this line does nothing

  13. Replies

    Re: ActionPerformed (Action Event) with

    Why do you want a private nested ButtonListener class? In general the instances of a class should share common behaviour (that's what makes it useful to model them as a class) but the instances of...
  14. Re: What is the reason of this output please help me

    In general we compare instances of classes using their equals() method: i1.equals(i2) etc. The == operator tests for whether the two variables refer to the same object and this is a much more...
  15. Replies

    Re: Tic Tac Toe Game Issue

    Also at
  16. Replies

    Re: Sphere Java Assignment

    Yes, I agree. Also at

    @OP: If you are going to start a discussion at multiple places could you post a link at each of them to all of the others? That way everybody who...
  17. Re: Using Scanner class in a child or derived class

    The message is saying that assessment was declared to be of type Assessment, but the code for the Assessment class (not posted) does not include any such method.

    If addTestAnswers() is supposed to...
  18. Replies

    Re: Calling child methods from main

    Generally we talk about "child" and "parent" in connection with classes.

    In general any method - main() or otherwise - can call methods of any class whether or not it is a child class. The...
  19. Re: Help with Bin to Hex and Hex to Ascii program

    Your file name has a .Java extension with a capital "J". JGrasp (and the javac.exe compiler) is expecting it to be named with a lower case "j".
  20. Re: Implement a Set abstract data type using singly linked lists

    Use a Tuple constructor to create a tuple. (I guess this is what you mean by "set two elements of the tuple"). Then use the ListSet add() method to add the tuple to the ListSet you are going to...
  21. Replies

    Re: Need help with understanding code

    First, be skeptical. Take the snippet of code and turn it into the main method of a class. Add some code to calculate the sum and print it out.

    If your code doesn't compile, post it and the...
  22. Re: For loop question -- addition and division

    Yes, that (the initialisation plus the 4 iterations) will give you exactly what you described initially.

    You're welcome.
  23. Re: For loop question -- addition and division

    What is this line supposed to do? It is rather confusing because it prints two times the number just added to the total. In particular it prints "5" when the number added to the total was "2.5". ...
  24. Re: For loop question -- addition and division

    Close. You have a variable total which is supposed to keep track of the total. So you would say

    userNum = (userNum/2.0);
    total += userNum; // adds userNum to the running total

  25. Replies

    Re: anyone know the answer?

    The usual procedure is to code it, run it, and see what is returned. The String hashCode() method is documented here.

    The previous two results to what?


    Also at...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4