Bob Denver, who played the title character on "Gilligan's Island," made a surprise appearance at the courthouse and pleaded no contest to possessing marijuana.

Denver's plea agreement means he won't have to stand trial Sept. 3 on the misdemeanor charge, which accused him of possessing about 11/2 ounces of marijuana and drug paraphernalia.Denver was placed on six months' unsupervised probation.

Denver, who entered his plea last week, declined comment.