Error: Type mismatch: cannot convert from java.lang.String to String
this error happens whenever i try to do something related to string for example: "String sc = sc.nextLine();" or "String s1 = "Enter a number"", this error happens during compiling.
Static Error: This class does not have a static void main method accepting String[].
this error doesnt show when compiling, but rather when running a code, for example:
"import java.util.Scanner;
public class testing
{
public static void main (String [] args)
{
Scanner sc = new Scanner (System.in);
System.out.println (2+3);
}
}"
since there is no code like "String sc = sc.nextLine()" or "String s1 = "Enter a number"" in the second code, the first error doesnt occur.
i need help troubleshooting
#i have 2 errors
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
what program are u using to code ?
Dr java
@unborn patio
I know it is not a code error, I don't know what's causing this issue, googling or chat gpt couldn't help me with the situation
We recommend using a good IDE like intellij CE.
let me try this real quick
Did you create a class named String?
I tried idea and after it reconfigured java and stuff, Dr java also started working as it should. Thank you
Like "public class string_1"? Yes
why?
I was studying the string chapter of my course and since there are 3 parts, each are named string _1 string_2 and so on
well but did you create a class thats called String just like the existing string class in java?
Just string? No
I assume that causes the similar issues
You can use /help-thread-close for that.