System.out.println(String apple); System.out.println(String peach); This is what was set to me com/codegym/task/task01/task0135/Solution.java:15: error: ')' expected System.out.println(String apple); ^ com/codegym/task/task01/task0135/Solution.java:15: error: illegal start of expression System.out.println(String apple); ^ com/codegym/task/task01/task0135/Solution.java:16: error: ')' expected System.out.println(String peach); ^ com/codegym/task/task01/task0135/Solution.java:16: error: illegal start of expression System.out.println(String peach);
What is wrong in my code
You must be signed in to leave a comment
4 March 2019, 12:09
The String should be used before println (declaration with value), try this: String peach="Peach"; System.out.println(peach); The others should be the same.
4 March 2019, 07:25
3 March 2019, 21:35
just remove the type "String", and it will run.
3 March 2019, 20:59
The println() method accepts different type of arguments. It can accept primitive types such as string, int, long double and so on. But we don't declare the primitive variable in the println method. You initialize your peach variable outside the println method and pass just "peach" in the arguments. Hope this helps.
3 March 2019, 19:12
I think println doesn't accept this kind of argument.Once you created variable you type variable type and variable name after that you can call variable by variable name.If you try create variable with same name and type programm will be confused which variable to call and that is why this is not allowed.I hope this will help you :-)