CHICAGO  Justice Sonia Sotomayor, speaking at a law school here on Monday, said she had “taken heat” at her Supreme Court confirmation hearings two summers ago in part because she was the first Hispanic nominee.

“People have views of me and expectations of me that are based on stereotypes,” she said.

In her most candid and extensive public remarks since joining the court in 2009, Justice Sotomayor reflected on the advice she had received from colleagues, her discomfort with becoming a celebrity and the role public opinion plays in judicial decision making.

She offered advice to lawyers who appear before the court and to students who want to serve as law clerks there. And she criticized Chief Justice John G. Roberts Jr., saying his approach to matters of racial justice was too simplistic.

She spoke for 90 minutes at the University of Chicago Law School, answering questions from Prof. David A. Strauss and from students. A recurring theme was that the public still did not know her very well.