When imported the ArrayList utility on my project, the ArrayList functionalities won't work
Preconditions:
Creaed a project : Records
Package : martin.vangenderen
Two Java Classes created : Main and Records
In Main class, i have imported the ArrayList utility to practice with the subject of ArrayList.
Whenever i want activate the submethods of the ArrayList e.g :
System.out.println((i) + " City : " + contact.get(i).getCity());
The output is : The first name in the list is martin.vangenderen.com.Contact@42d80b78
Or another program:
Three classes: Main, MobilePhone, Contacts
MobilePhone has the ArrayList utility
Class Çontact' has returns a record of type Contact
My code :
if (findContact(contact.getName()))
The result is an underlining error, displaying :
findContact(martinvangenderen.Contact) in MobilePhone cannot be applied to (Java.lang.String)
Another program, from a tutorial, also using ArrayList works perfectly. I cannot see the difference.
Thanks in advance for your support.
Kind regards, Martin.
Please sign in to leave a comment.
For Java language support questions please use https://stackoverflow.com/.
This support channel is for IntelliJ IDEA specific issues. If you believe there is a bug in the IDE, please provide a reproducible test case at https://uploads.jetbrains.com and double check that the same code compiles and works as expected outside of the IDE.
Error:(17, 40) java: incompatible types: java.lang.String cannot be converted to martinvangenderen.Contact
Thank you. This is also from the compiler.
So, you suggest to copy mt whole project to https://uploads.jetbrains.com ?
If the code doesn't compile, the issue is with the code, not with the IDE.
If you don't know what is the problem with your code, ask a question at https://stackoverflow.com/ to get help from the community.