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)
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!