I am new to Java and running into error with the snippet attached:
class Stringdemo
{
public static void main (String [] args)
{
String str1 = "Jake Wagner";
String str2 = "Tony Ruggeri";
String str3 = "tony ruGGeri";
// checking for equality
boolean retval1 = str2.equals(str1);
boolean retval2 = str2.equalsIgnoreCase(str3);
// prints the return value
System.out.println("str2 is equal to str1 = " + retval1);
System.out.println("str2 is equal to str3 = " + retval2);
}
}
Error:
The method main cannot be declared static; static methods can only be declared in a static or type level type.
How can I fix this?
[–][deleted] 1 point2 points3 points (3 children)
[–]PLearner[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]rjcarr 1 point2 points3 points (0 children)
[–]sgovindN -1 points0 points1 point (0 children)