0
点赞
收藏
分享

微信扫一扫

java 标志一个方法为过时方法


使用 Deprecated 来标记方法

@Deprecated
//用来判断ip是否合法
public boolean checkIp(String tempIp) {
String regex = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}";
// String regex2 = "([1-9]|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])(\\\\.(\\\\d|[1-9]\\\\d|1\\\\d{2}|2[0-4]\\\\d|25[0-5])){3}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(tempIp);
return m.matches();
}


之后在使用该方法时,方法名会有一根删除线标记

boolean isIP = cv.checkIp(ipString);


:boolean isIP = cv.

checkIp(ipString);




举报

相关推荐

0 条评论