**For example, consider the following text:**

```
import java.util.*;

/* My program
by           */
public class Program {
   public static void main(String[] args) {
      System.out.println("Hello, world!"); // a println
   }

   public static /* Hello there */ void foo() {
      System.out.println("Goodbye!"); // comment here
   } /* */
}

```

If the file contained this text, the program should output the following text:

```
import java.util.*;

public class Program {
   public static void main(String[] args) {
      System.out.println("Hello, world!");
   }

   public static  void foo() {
      System.out.println("Goodbye!");
   }
}

```

**Well i wrote the code for it and named a function called `stripComments` which accepts a scanner input of the file in question :**

```
public void stripComments(Scanner input){

    while(input.hasNextLine()){
        boolean flag=false;

        String scan=input.nextLine();
        Scanner line=new Scanner(scan);
        while(line.hasNext()){

            String token=line.next();
            if(token.equals("/*")){
                while(line.hasNext()){

                    if(line.next().equals("\\*")){
                        token=line.next();
                        flag=true;
                        break;
                    }
                }
                if(!flag){
                    while(input.hasNextLine()){
                        scan=input.nextLine();
                        line=new Scanner(scan);

                        while(line.hasNext()){

                            token=line.next();
                            if(token.equals("*\\")){

                                token=line.next();
                                flag=true;
                                break;
                            }
                        }

                    }

                }
            }
            else{
                System.out.print(token+" ");

            }

        }
        System.out.println();

    }

}

```

However the output that is produced is :

```
import java.util.*; 

```

That's it!!!! 

Can anybody point out where i went wrong?