构造器
ParsePosition()
方法
equals()重写过,其实如果有重写过的就会在那个方法总结中显示出来,也就说明只要内容相同就返回true,无需是同一个对象
getErrorIndex() 不知道具体含义,和用来干嘛
getIndex()和上面一样的问题
hashCode() 是用equals()标准来计算的。因为相同的内容返回一样的hashCode(),这样的标准,很适合用在HashCode中
import java.text.*;
import java.util.*;
import java.time.*;
import static java.text.MessageFormat.*;
import static java.text.AttributedCharacterIterator.*;
public class Test
{
public static void main(String[] args) throws Exception,Throwable
{
//ParsePosition
ParsePosition pp1 = new ParsePosition(1);
System.out.println(pp1);
ParsePosition pp2 = new ParsePosition(1);
System.out.println(pp1.equals(pp2) );
System.out.println(pp1.getErrorIndex());
System.out.println(pp1.getIndex());
System.out.println(pp1.hashCode());
System.out.println(pp2.hashCode());
System.out.println("");
System.out.println(pp1.getErrorIndex());
pp1.setErrorIndex(10);
System.out.println(pp1.getErrorIndex());
System.out.println("");
System.out.println(pp1.getIndex());
pp1.setIndex(10);
System.out.println(pp1.getIndex());
System.out.println(pp1.toString());
}
}