I was doing an exercise to string numbers in Java reference books, but when I tried to compile the code as an example, an error was displayed for the following parts:
If you are familiar with Java, please let me know.
Where applicable:
s=Integer.toString(i,2);
s = integer.toString(i,16);
error messages:
Incompatible type; unable to convert java.lang.String to String
source code:
class String {
public static void main(String args[]){
Strings;
inti = 45;
s = Integer.toString(i,2);
System.out.println(s);
s = Integer.toString(i,16);
System.out.println(s);
}
}
class String {
public static void main(String args[]){
Strings;
This s
is an instance of the String
class created by the questioner.Instead of Java standard String
.
Rename your String
or s
declaration to java.lang.String;
.
The code in the question text creates a class named
String
, but it is different than expected because it is named String
with Java built-in
679 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
524 Uncaught (inpromise) Error on Electron: An object could not be cloned
543 Understanding How to Configure Google API Key
544 PHP ssh2_scp_send fails to send files as intended
543 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.