Search:

Type: Posts; User: Norm

Page 1 of 2 1 2

Search: Search took 0.09 seconds.

  1. Re: Creating Random unused ID number for every library member.

    Have you read the API doc for the compareTo method to see what it does?
    Also I suggest that you write a small testing program that uses the compareTo() method with some short Strings and prints out...
  2. Re: Creating Random unused ID number for every library member.

    Cheers
  3. Re: Creating Random unused ID number for every library member.

    "AS" and "ASDF" are two Strings I used to show the difference between contains and equals.
    That comparison has nothing to do with java. It was an attempt to discuss the logic of what it means for...
  4. Re: Creating Random unused ID number for every library member.

    Does the logic work?
    "AS" is contained in "ASDF"
    "AS" does not equal "ASDF"
  5. Re: Creating Random unused ID number for every library member.

    Depends on the programs requirements.
    The String "ASDF" contains the String "AS"
  6. Re: Creating Random unused ID number for every library member.

    Use the equals() method when comparing the contents of objects for equality.
  7. Re: Creating Random unused ID number for every library member.

    If you want to test for equality use the equals() method.
  8. Re: Creating Random unused ID number for every library member.

    Glad you got it working.
  9. Re: Creating Random unused ID number for every library member.

    Look at how you use the get() method and the set() method.


    I can't see the highlighting. Can you compile the code with javac and get the error message?
  10. Re: Creating Random unused ID number for every library member.

    Sorry, I don't understand your last post.

    You should remove your code that adds 21 and use the add() method.
  11. Re: Creating Random unused ID number for every library member.

    That kind of code is hard to write. I'd use the Calendar class's add() method because it will have been tested and will work correctly.
  12. Re: Creating Random unused ID number for every library member.

    There is no main() method in the class so there is no way to execute it for testing.
    There needs to be code that executes and shows the problem for testing.



    Where does the code call the add()...
  13. Re: Creating Random unused ID number for every library member.

    The posted code does not compile. One problem is missing import statements.

    Another problem is there is no code to test the Loan class. There needs to be a small class with a main() method that...
  14. Re: Creating Random unused ID number for every library member.

    The compiler is correct. A statement consisting only of a variable name is not valid.
    What did you want to do with the value in the variable?
  15. Re: Creating Random unused ID number for every library member.

    You need an instance of the Loan class to call the getLoanDate() method. It should be the instance that has the date in it. Something like this:


    Loan refToLoanClass = new Loan(); // get...
  16. Re: Creating Random unused ID number for every library member.

    You can not call a non-static method without using an instance of the class.

    Loan.getLoanDate();

    You need an instance of the Loan class to call the getLoanDate() method. It should be the...
  17. Re: Creating Random unused ID number for every library member.

    Did you read the API doc for the format() method? What args does it take?


    That is NOT a data type or classname. You should have learned by now that spelling is very important in java...
  18. Re: Creating Random unused ID number for every library member.

    What type is loanDate?
  19. Re: Creating Random unused ID number for every library member.

    Please post the full text of the error message that shows where the error happens and the contents of the source statement.
  20. Re: Creating Random unused ID number for every library member.

    Glad you got that one solved.


    Java is case sensitive. Spelling it as written in the API doc will work better.

    One confusing way you've coded the field arg is using a variable name instead of...
  21. Re: Creating Random unused ID number for every library member.

    Look at the add() method. What is the first arg to that method?

    You will need to learn to read the API if you want to write any programs.
    Copy the contents of the API doc you don't understand...
  22. Re: Creating Random unused ID number for every library member.

    Did you read my last post? You can't code anything that comes into your head. You must follow the rules as defined in the API.

    The variable: Date does NOT exist in the GregorianCalendar class.
  23. Re: Creating Random unused ID number for every library member.

    Read the API doc and answer this question:
    What value should the first arg to the add() method be?

    See posts #17 and 29 for examples.
  24. Re: Creating Random unused ID number for every library member.

    What is that value supposed to be?
    Does the class for the object referred to by: dateLoanDueBack (GregorianCalendar) define a variable: Date? If not, then the code makes no sense.

    What value...
  25. Re: Creating Random unused ID number for every library member.

    If that message is from the compiler, (it looks different from normal compiler error messages)
    then the compiler can not find a definition for the variable: Date.
    BTW conventions say variable...
Results 1 to 25 of 47
Page 1 of 2 1 2