Eclipse设置选中的相同变量高亮显示

选择:windows-> preferences->java->Editor->Mark Occurences

选择最上的复选框,下面的就有很多了。

其中的Local variables就是变量的高亮显示。

如果想改变默认选中的背景颜色,可以按照以下步骤修改: 
选择:windows-> preferences->java->Editor->Mark Occurences->第一行有个“Annotations”点击进入,显示出列表,找到 Occurrence annotation 右边选择Color即可。