Java教材课件第4章数组和字符串.ppt

第4章 数组和字符串 掌握 Java 中的 数组概念、 声明、 创建、初始化 与 使用; 熟练掌握 Java 的数组编程方法; 掌握 Java 中字符串的概念; 熟练掌握 Java 中 String 类、StringBuffer 类中的有关方法应用; 了解向量的声明、添加、修改、删除等操作。 常见编程错误 与在其他编程语言(例如C或C++)中声明数组不同, Java 数组的元素个数不能在数组名后的方括号中定义, 否则将导致语法错误。如, 声明“int c[12];”,会产生语法错误。 数组 array 是一组连续的存储单元, 且每个成员均有相同的名称和类型。 An array is a group of contiguous memory locations that all have the same name and the same type. 带下标的数组名是一个左值,可放在赋值语句的左边,以便将一个新值放入数组元素中。 A subscripted array name is an lvalue – it can be used on the left side of an assignment to place a new value into an array element. 声明数组和给数组分配空间 Declaring and Alloca

文档评论(0)

1亿VIP精品文档

相关文档