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...
Type: Posts; User: Norm
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...
"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...
Does the logic work?
"AS" is contained in "ASDF"
"AS" does not equal "ASDF"
Depends on the programs requirements.
The String "ASDF" contains the String "AS"
Use the equals() method when comparing the contents of objects for equality.
If you want to test for equality use the equals() method.
Glad you got it working.
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?
Sorry, I don't understand your last post.
You should remove your code that adds 21 and use the add() method.
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.
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()...
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...
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?
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...
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...
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...
What type is loanDate?
Please post the full text of the error message that shows where the error happens and the contents of the source statement.
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...
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...
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.
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.
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...
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...