#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { NSArray *arr1 = [NSArray arrayWithObjects:@"one",@"tow", nil]; //等價於 NSArray *arr2 = @[@"one",@"two"];//不可變數組纔有這種特性 NSLog(@"%@ %@",arr1,arr2); NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"1",@"one",@"2",@"two", nil]; NSLog(@"dict:%@",dict); NSDictionary *dict2 = @{@"one": @"1",@"two":@"2"}; NSLog(@"dict2:%@",dict2); //NSString *str = [dict2 objectForKey:@"one"]; //等價於新特性 NSString * str = dict2[@"one"]; NSLog(@"str:%@",str);//str:1 } return 0; }