0
Java class does it work like this?
class MyClass { /*static void x creates a varible that can be called from main which can be used to create diffrent strings*/ static void x (String y) { System.out.println("My favorite games are " + y); } /*main*/ public static void main(String[ ] args) { /*calls x*/x(/*string y =*/"Zelda"); /*calls x*/x(/*string y =*/"Mario"); /*calls x*/x(/*string y =*/"Sonic"); /*calls x*/x(/*string y =*/"Tekken"); /*Each once executes with System.out.println*/
2 Answers
+ 4
Other than missing the closing braces for the main method and My class this code works fine. x() however is not a variable as you're describing it in your comment, it is a method.
0
I just tried it in code playground:
..\Playground\\.java:17: error: reached end of file while parsing x("Tekken");