Pages

java Excercise - 2

Comment out a few lines to display
2 plus 3 is equal to 5
on the screen.
Requirements:
  • The program should display "2 plus 3 is equal to 5" on the screen.
  • Don't change the line 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.
    public class Solution {
        public static void main(String[] args) {
            int a = 3, b = 2;

            System.out.print("two");
            System.out.print(b);
            System.out.print(" plus ");
            System.out.print(" minus ");
            System.out.print(a);
            System.out.print("three");
            System.out.print(" is equal to ");
            System.out.print(" equals ");
            System.out.print("five");
            System.out.print(a + b);
        }

    }

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.