2 + 3 = 5
Comment out a few lines to display
2 plus 3 is equal to 5
on the screen.
Note: Don't comment out the lines with variable declarations.
Requirements:
1. The program should display "2 plus 3 is equal to 5" on the screen.
2. Don't change the lines that declare variables.
3. You need to comment out at least one line.
4. Don't change or add commands responsible for output. You can comment them out.
package com.codegym.task.task01.task0108;
/*
2 + 3 = 5
*/
public class Solution {
public static void main(String[] args) {
System.out.println("2 plus 3 is");
System.out.println("equal to 5");
String s = "23";
int a = 3, b = 2;
String four = "four";
String three = "3";
System.out.print("two");
System.out.print(" plus ");
System.out.print(s);
System.out.print(b);
System.out.print(" plus ");
System.out.print("three");
System.out.print(a);
System.out.print(" is equal to ");
System.out.print("five");
System.out.print(a + b);
}
}
The task failed to pass testing
Detailed information about verification of your program:
The program should display "2 plus 3 is equal to 5" on the screen.
Don't change the lines that declare variables.
You need to comment out at least one line.
Don't change or add commands responsible for output. You can comment them out.
If I do LIKE THIS ALSO COMING ERROR PLS TELL THE SOLUTION
package com.codegym.task.task01.task0108;
/*
2 + 3 = 5
*/
public class Solution {
public static void main(String[] args) {
System.out.println("2 plus 3 is equal to 5");
String s = "23";
int a = 3, b = 2;
String four = "four";
String three = "3";
System.out.print("two");
System.out.print(" plus ");
System.out.print(s);
System.out.print(b);
System.out.print(" plus ");
System.out.print("three");
System.out.print(a);
System.out.print(" is equal to ");
System.out.print("five");
System.out.print(a + b);
}
}
The task failed to pass testing
Detailed information about verification of your program:
The program should display "2 plus 3 is equal to 5" on the screen.
Don't change the lines that declare variables.
You need to comment out at least one line.
Don't change or add commands responsible for output. You can comment them out.
Please tell the solution
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Learner
5 October 2018, 06:31
Did you run your program and check the output?
The output should only display: 2 plus 3 is equal to 5 and nothing else.
1. You do notice a lot of System.out.print statements in the program. If you will run your program, then all of those print statements will execute. We don't want that. Therefore, comment the print statements that are not required. For example, System.out.print(s); will print value of s which is 23. It is not required.
So, add // infront of the statement to comment it: //System.out.print(s)
2. Do not add any new statement or delete any statement from the given code. Only comment.
0