+ 1

I am getting an error as 'illegal start of expression' while running the below program. Kindly suggest

public class Program { public static void main(String[] args) { String firstName, lastName; firstName = "David"; lastName = "Williams"; int age= 25; System.out.println("My name is " + firstName +" "+lastName + " and I am " + age+); } }

4th Jun 2018, 7:46 AM
Mangesh Deshpande
Mangesh Deshpande - avatar
3 odpowiedzi
0
age+ should probably be age
4th Jun 2018, 8:01 AM
Max
Max - avatar
0
int age; age =25; try this
4th Jun 2018, 8:43 AM
chapala suneela
chapala suneela - avatar
0
no + after age in println
4th Jun 2018, 10:14 AM
Krzysztof303
Krzysztof303 - avatar