+ 1
Find the mistake in this coad
public class Program { public static void main(String[] args) { String name = "Howard"; int age = 42; System.out.println(name+"is" +age+"years old."); } }
15 Answers
+ 3
age is commented. Remove the comment from age and System.out.println
+ 3
Please put Java in post tags, 'findthemistake' doesn't bear any relevance to the code
https://code.sololearn.com/W3uiji9X28C1/?ref=app
+ 2
What is the task?
Check the white spaces in the output string.
+ 2
Again: What is the 👉task? What error message do you get? Link the complete code.
+ 1
What is the 👉TASK? What did you try?
+ 1
Yes I was going to say the same thing as Lisa, that you commented out age
+ 1
>> System.out.println(name+" is " + age+" years old.");
0
Not working
0
Can you explain me how to do
0
public class Program {
public static void main(String[] args) {
//declare variables
String name = "Howard";
/* declare the age
int age = 42;
*/
//output values
//System.out.println(name+" is "+age+" years old.");
}
}
Fix this coad
In java comment
0
But the solution is showing this coad
public class Program {
public static void main(String[] args) {
String name = "Howard";
int age = 42;
System.out.println(name+"is" +age+"years old.");
}
}
0
And not working
0
Thank you so much finally it worked
0
Convert the Integer age to String using str function.
0
There is a syntax error in the code. The correct method signature for the main method in a Java program is:
public static void main(String[] args)
In the given code, the main method is declared as public static void main(String[] args), which is missing the void keyword before the main method name.