Java can't find the 'equal' method - java

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 days ago.
Improve this question
I tried to check if a property was equal to a string but I keep getting this error
Code:
if (prop.getProperty("quit").equal("true")) {
}
Error:
cannot find symbol
symbol: method equal(java.lang.String)
location: class java.lang.String

The method name is equals not equal.

Related

Split string with delimiter but keep one delimiter on either side (java) [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 days ago.
Improve this question
I have a string like "{hello}{bye}"
How can I split() the string so my output is ["{hello}, "{bye}"]
I have tried splitting with "}{" but it leaves me without the }{.
Have also tried .split("((?<=})|(?={))") but I get a "number expected" syntax error beneath the {

How to get Java 19 to recognize 'record' keyword [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 months ago.
Improve this question
I am using jdk 19 and want to make a record class for my Java project.
When I declare the class Person:
public record Person (String name) {}
I get the error
'class' or 'interface' expected
I don't understand why it will not let me use the record keyword.
Any help is appreciated
The records feature arrived in Java 16.
Project language level is selected to be 15, why didn't you change?

Invalid method declartion required return type, Java controller method [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I know that it may be a silly mistake but I am looking at this code for about 15 minutes and I cannot see nothing wrong. Besides I can continue to do my work with this error.
I have the following method
GetMapping("/pagina/imoveis-residenciais-venda")
------------------------------------------------- (red marker of error)
public List<Imovel> recuperarPaginaImoveisResidenciaisVenda(){
List<Imovel> imoveis = this.imovelRepositorio.recuperarPaginaImoveisResidenciaisVenda();
return imoveis;
}
And the following error message, as GetMapping is underlined with the red marker:
invalid method declaration, required return type
GetMapping is an annotation, and annotation must start with an # sign so your code should look like this
#GetMapping("/pagina/imoveis-residenciais-venda")
public List<Imovel> recuperarPaginaImoveisResidenciaisVenda(){
List<Imovel> imoveis = this.imovelRepositorio.recuperarPaginaImoveisResidenciaisVenda();
return imoveis;
}

How to fix '(' or '[' expected [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I get this error when I try to do an Onclicklistener to my customInfoWndow
The code for that is specifically this:
(GoogleMap.OnInfoWindowClickListener((new GoogleMap.OnInfoWindowClickListener))
How may I solve this error.
Thanks a lot!
You have a new keyword, so you're constructing an object. If the constructor takes no parameters, you must put empty braces anyway:
new GoogleMap.OnInfoWindowClickListener()

Whats the need of ')' in statment [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
System.out.println(i+"\t\t\t"+(i*i)+"\t\t\t"(i*i*i));
^
error:')'expected
You're missing a "+"
Try this :
System.out.println(i+"\t\t\t"+(i*i)+"\t\t\t"+(i*i*i));

Categories