PMD violation : Use explicit scoping instead of the default package private level

爷,独闯天下 提交于 2019-12-11 09:36:09

问题


I just begin to use PMD. I can't fix in my code PMD violation : "Use explicit scoping instead of the default package private level".

It appears on these places in my code:

String carName = ""; //car name
String carSize = ""; //car size
String carColor = "";//car color

ArrayList<Car> carList = new ArrayList();
static MyLog log = new MyLog(); //log

How to fix it?


回答1:


With regards to explicit scoping, make your fields private to enforce encapsulation



来源:https://stackoverflow.com/questions/26791038/pmd-violation-use-explicit-scoping-instead-of-the-default-package-private-leve

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!