if we execute System.out.println("Xys"); and System.err.println("Fdfd");
They both should work Exactly the same as out and err are the objects of the same class except for the fact that they don't.
Why out.println() prints in black and err.println() prints in red.
Because the IDE you're using prints stderr in red, and stdout in black.
This has nothing to do with Java, and everything to do with the environment you're in–it's what's doing the coloring, not Java itself, which doesn't care how its output is actually rendered.