📄 address.java
字号:
import java.util.*;public class Address { public String addressLine1; public String addressLine2; public String city; public String state; public String zip; public Address( String line1, String line2, String city, String state, String zip ) { addressLine1 = line1; addressLine2 = line2; this.city = city; this.state = state; this.zip = zip; } public static void main( String args[] ) { HashSet set = new HashSet(); set.add( new Address("123 Peachtree St", "", "Atlanta", "GA", "30305") ); set.add( new Address("100 Main St", "", "Any Town", "NY", "10101") ); // retrieve an iterator from the collection Iterator iter = set.iterator(); while ( iter.hasNext() ) { // loop while elements remain // elements are returned as Object so cast to subtype Address add = (Address)iter.next(); System.out.println( add.zip ); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -