Need help with Stage 6 here?


#1

I'm not sure what problem?

public class WhiteSpace {
	public static void main(String[] args) {

    	boolean isFormatted = System.out.println(isFormatted);
  }System.out.println(isFormatted);
}
	
  
}

#2

You create a variable isFormatted

but variables must store values based on their type declaration and in your case its

The System.out.println() call is void(meaning it does not return anything or yield any value) meaning you cannot store it in a variable.


#3

I don't think void means you can't store a variable in it. Void just is referring to output of the function.

This is what I did for the problem.

public class WhiteSpace {
	public static void main(String[] args) {

		boolean isFormatted = false;
                System.out.println(isFormatted);

	}
}

I'm not sure why you tried to set a boolean value to a System.out.println. Boolean values only take a Boolean value :slightly_smiling: .

Hope that helps :sunny:


#4

Here try this create a boolean variable or any variable type and initialize it with the call of a void method(could be one you create or use one from the standard libraries). run the code and see if it compiles or better yet try this code

public class Main {
	public static void main(String[] args) {
	    
    	boolean isFormatted = System.out.println();
    	
    	System.out.println(isFormatted);
  }
}

Does it compile? if yes(run it) what is the output? if not what is the error?