Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why can't I print this variable?

I get this error:

The type java.io.FilterOutputStream cannot be resolved. It is indirectly referenced from required type java.io.PrintStream

in this block of code:


public class MalyTest {

    private Integer i = 3;

    public void doRoboty() {
        
        
        System.out.println(i);
        
    }
    
    
}

Error disappear once I try to print something else like in this block of code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel


public class MalyTest {

    private Integer i = 3;

    public void doRoboty() {
        
        
        System.out.println("Hello");
        
    }
    
    
}

What is the reason?

>Solution :

Your variable i is not a String. Try to do this:

System.out.println(i.toString());

or

System.out.println("Variable i value is: " + i);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading