Why i am getting this error?
the method
String toString() declared in class String should not be overide the method of the same signature declared in java.lang.object.They must havr thesame return type
public String toString()
/\
even though i have not wrtiien any toString method
public class Test1{
int temp;
Test1 Test1(){this.temp=10;
return this;
}
public static void main(String args[]){
Test1 t1=new Test1();
Test1 t2=t1.Test1();
if (t1==t2){
System.out.println("EQUAL");
}
else{ System.out.println("NOT EQUAL");
}
}
}
same error for this code also
public class Switch{
public static void main(String args[]){
int i='c';
switch(i){
case 'c': System.out.println("!!!");
break;
default : System.out.println(i);
break;
}
}