Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Cannot resolve symbol (Java)

The mistake here is Cannot resolve symbol ‘input’ .

Why?

public class CalcKata {

    public static void main(String[] args) {
        public static String calc (String input){
        }
    }
}

The code is writed on Java v17.
java version "17.0.2" 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I tried to write and run but it didn’t help.

>Solution :

You can’t declare the function like that in Java. Java doesn’t allow you to define methods inside other methods

public class CalcKata {
    public static void main(String[] args) {}
    public static String calc(String input) {}
}

This is the correct one, hope that helps!

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading