What will be the result of compilation and execution of the following code?
public class TestClass {
    public static void main(String[] args) {
                String s = new String(){
                    public String toString(){
                        return "new method";

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes