Short version: There are no such examples.
Longer version: Given any topological space $X,$ we always have that $X$ and $\emptyset$ are both closed and open. We say that such a space is connected if no other subsets of $X$ are both closed and open. The real line is an example of a connected topological space, so there are no other examples.
Longest version (that I'm going to post): Suppose that $A\subseteq\Bbb R$ is both closed and open, and that $A\neq\emptyset.$ Since $A$ is open and non-empty, then it is a countable (possibly finite, but non-empty) union of disjoint open intervals (some of which may be unbounded, but none of which are empty).
Suppose (by way of contradiction) that $\Bbb R\setminus A$ is also non-empty. Since $A$ is closed, then $\Bbb R\setminus A$ is open, so that $\Bbb R\setminus A$ is also a countable (possibly finite, but non-empty) union of disjoint open intervals (some of which may be unbounded, but none of which are empty).
As $A$ and $\Bbb R\setminus A$ are disjoint, then all of their component open intervals are also disjoint. Thus, since $\Bbb R=A\cup(\Bbb R\setminus A),$ then $\Bbb R$ is also a union of countably-many open intervals--possibly finitely-many, but there at least two such intervals (some of which may be unbounded, but none of which are empty). Since there are at least two, each non-empty, then one of the intervals (say $I$) has a least upper bound (say $y$). Since $y\in\Bbb R,$ then $y$ must lie in one of the component intervals (say $J$). Since $J$ is open and $y\in J,$ then there is some $c>0$ such that $(y-c,y+c)\subseteq J.$ But then there is some $x\in I\cap(y-c,y+c)$ (why?), so $x\in I\cap J,$ so $I=J$ (why?). Thus, $y\in I$ (why?), which is impossible (why?), and so we have reached the desired contradiction.
Since assuming $\Bbb R\setminus A$ to be non-empty yielded a contradiction, then $A=\Bbb R.$