-1

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.

ra1n89
  • 3
  • 3
  • The code as shown does not produce a _"Cannot resolve symbol error"_. Instead it produces _"CalcKata.java:4: error: illegal start of expression"_ and _"CalcKata.java:7: error: class, interface, enum, or record expected"_. – Mark Rotteveel Aug 27 '23 at 07:50

1 Answers1

1

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!

Gxogac
  • 124
  • 9