Remove comments

Report a typo

You are given a line of Java code. The author of the code tried to be a good programmer and left a lot of comments. Now, however, someone wants to actually understand how this code works, but these comments happen to be pretty uninformative and describe obvious things. Also, they slow down the process of code reading.

Your task is to delete all these ugly useless comments from the code.

The programmer wrote "/* this type of comments */" as well as "// this type of comments".

Sample Input 1:

Integer variable /* it only contains integers */= new Integer("0"); // now contains zero

Sample Output 1:

Integer variable = new Integer("0");

Sample Input 2:

/* new line */String /* we need String, not int */s /* bad name, I think */= "123";

Sample Output 2:

String s = "123";

Sample Input 3:

int b = 0;/* expression */ b = b /* **/* b /* b * b = b squared */; // 0 * 0 = 0

Sample Output 3:

int b = 0; b = b * b ;
Write a program in Java 17
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String codeWithComments = scanner.nextLine();

// write your code here
}
}
___

Create a free account to access the full topic