1. first option

  • when you don’t import the class you get an error
  • you can just click on the error and import the class

example

  1. Add this line of code in the start method:
PrintStream out = new PrintStream(System.out);

2. You will get an error:

error PrintStream javaJust click on it:

error printstream java3. and dubbel-click on Import ‘PrintStream’ (java.io); eclipse automatically adds the code on the right place:

import java.io.PrintStream;

 

2. second option

You add the import code manual.

  1. The name of the code can be found here: https://docs.oracle.com/…… or I will mention it in the tutorial
  2. This is the place where you have to add the code:import location

    EXAMPLE

    See line 3
    package Output;
    
    import java.io.PrintStream;
    
    public class PrintConsole {
    	
    	void start () {
    		PrintStream out = new PrintStream(System.out);
    	}
    
    	public static void main(String[] args) {
    		new PrintConsole().start();
    
    	}
    
    }

 

.